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 / July 2008

Tip: Looking for answers? Try searching our database.

Submitting partial form data to multiple web services

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Stokes - 23 Jul 2008 13:49 GMT
Hi

I would like to submit parts of my Infopath form data to multiple SharePoint
lists using web services.  I would like to specify the site receiving the
data by referencing data in my main data source and I would like to pass part
of the from data to one list (risks) and another set of data in the form to
another list on the same site (deliverables).

I know how to send from data to SharePoint lists through web services but
not how to change the site url based on data contained in the form or how to
send part of the data to one list and part to another.

can anyone help me with this?

Andrew
Andrew Stokes - 23 Jul 2008 15:49 GMT
I decided to do it with some c#

//set up a web reference called MyWebService

//get the references to the site and lists from the document's data source
XPathNavigator navSiteURL =
navigator.SelectSingleNode("my:BusinessReview/my:Project/my:ProjectSite/my:ProjectSiteURL", this.NamespaceManager);
           XPathNavigator navRisksList =
navigator.SelectSingleNode("my:BusinessReview/my:Project/my:ProjectSite/my:RisksListGUID", this.NamespaceManager);
           XPathNavigator navDeliverablesList =
navigator.SelectSingleNode("my:BusinessReview/my:Project/my:ProjectSite/my:DeliverablesListGUID", this.NamespaceManager);

           MyWebService.Lists myList = new MyWebService.Lists();
           myList.Credentials =
System.Net.CredentialCache.DefaultCredentials;
           myList.Url = navSiteURL.ToString() + @"/_vti_bin/lists.asmx";
           XmlDocument doc = new XmlDocument();
           XmlElement mybatch = doc.CreateElement("Batch");

           mybatch .SetAttribute("OnError", "Continue");
           mybatch .SetAttribute("ListVersion", "1");
           mybatch .SetAttribute("ViewName", "");

           //I would replpace the title data with a reference to my
datasource
          //and I would add other list fields to be updated
           mybatch .InnerXml = "<Method ID='1' Cmd='New'>" +
              "<Field Name='ID'>New</Field>" +
              "<Field Name='Title'>a nice title for the first
item</Field></Method>";
           mybatch .InnerXml += "<Method ID='1' Cmd='New'>" +
              "<Field Name='ID'>New</Field>" +
              "<Field Name='Title'>another title for the next
item</Field></Method>";

           myList.UpdateListItems(navRisksList.ToString(), mybatch);

//do the same for the deliverables

> Hi
>
[quoted text clipped - 11 lines]
>
> Andrew
 
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.