Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2004

Tip: Looking for answers? Try searching our database.

form library title

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Belenky - 14 Dec 2004 11:30 GMT
How I can get document form library name in SharePoint to display it in
information text box on form?

Signature

Greg "Grishace" Belenky

Greg Belenky - 20 Dec 2004 12:45 GMT
> How I can get document form library name in SharePoint to display it in
> information text box on form?

If someone interested - I've just found solution for subject question:

1. Add to the Infopath form field to store library title, name it "Title"
for example
2. Define managed OnLoad event handler
3. Make web reference for Sharepoint's Lists web service:
http://<sharepoint>/sites/<site>/_vti_bin/Lists.asmx?wsdl
4. OnLoad handler will look like:
[InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
 try
 {
   Lists ws = new Lists();
   ws.Credentials = CredentialCache.DefaultCredentials;
   XmlNode sps = ws.GetListCollection();

   XmlNamespaceManager mngr = new XmlNamespaceManager(
sps.OwnerDocument.NameTable );
   mngr.AddNamespace( "def",
"http://schemas.microsoft.com/sharepoint/soap/" );

   string solutionUri =
HttpUtility.UrlDecode(thisXDocument.Solution.URI.ToString());
   string uri = new Uri(HttpUtility.UrlDecode(solutionUri),
true).PathAndQuery;

   XmlNode lib = sps.SelectSingleNode( "//def:List[@DocTemplateUrl='" + uri
+ "']/@Title", mngr );
   IXMLDOMNode num = thisXDocument.DOM.selectSingleNode( "//my:Title" );
   if ( lib != null ) num.nodeTypedValue = lib.InnerText;
 }
 catch
 {
   thisXDocument.UI.Alert( "Can't get library title");
 }
}

Signature

Greg "Grishace" Belenky

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.