Submitting to a SharePoint List
As you know, submitting to a Microsoft Windows SharePoint form library from an InfoPath form is quite simple: just add a “submit” type of data connection to InfoPath and away you go. However, submitting to a SharePoint List is another matter. In this post, we will take a look at the steps necessary to enable this functionality.
Step 1: Create the list
1. Create a new custom list named: MyContacts
2. From the Settings button choose List Settings
3. Click Create Column
4. Add the following columns/data types:
- FirstName, Single line of text
- LastName, Single line of text
- Email, Single line of text
- Phone, Single line of text
The next step is to create a Collaborative Application Markup Language (CAML) template that contains the same XML nodes as the columns we added to our list – this will be used as a secondary data connection in the InfoPath Form Template.
Step 2: Create the CAML template
1. Launch Notepad (or any text editor)
2. Copy and paste the following code to the Notepad document:
<?xml version="1.0" encoding="UTF-8"?>
<Batch OnError="Continue">
<Method ID="1" Cmd="New">
<Field Name='Title'></Field>
<Field Name="FirstName"></Field>
<Field Name="LastName"></Field>
<Field Name="Email"></Field>
<Field Name="Phone"></Field>
</Method>
</Batch>
3. Save this as: Add List Item Template.xml
Step 3: Create the InfoPath Form Template
1. Create a new, blank, browser-compatible form template
2. Add a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2. (Make sure the options “Include the data as a resource file in the form template” and “Automatically retrieve data when the form is opened” are enabled.)
3. Add a “Receive” type secondary data connection to the “MyContacts” SharePoint List created in Step #1 and make sure the option “Automatically retrieve data when the form is opened” is enabled.
NOTE: Be sure to include the “Title” field along with the custom fields we created.
Each SharePoint list is created with a unique identifier called a GUID. In order to submit items to a SharePoint list, you must know the unique GUID for that list. These next steps will enable you to identify the GUID for your “MyContacts” list.
Step 4: Identify the list GUID
1. Open a browser and navigate to the MyContacts list
2. From the Settings menu choose List Settings
3. In the browser’s address bar you will see the URL appended with “List=”
4. Copy everything after the equals sign and paste this into a text editor as we will need this value later on.
NOTE: We will need the list GUID to be formatted as “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}”. If your GUID appears as above with the hyphens and braces “escaped” (i.e. %7B for the braces and %2D for the hyphens) then you will need to replace the escaped characters with the braces and hyphens so when we use this GUID later, it will appear as: {1E76517B-2C36-4473-A420-A737D98589BC}
Step 5: Add controls to the InfoPath Form Template
1. Open the Data Source Task Pane
2. From the Data Source dropdown box choose the “MyContacts” connection
3. Right-click on “MyContacts” and choose Repeating Table – this will add a repeating table bound to that connection to your View
4. From the Data Source dropdown box choose Main
5. Add a text box to the “myFields” node named: ListName and set the Default Value property to the GUID value of your list – we will use this node to specify the list when we perform the Submit operation
To update the SharePoint list we will be using the “UpdateListItems” method of the SharePoint “lists.asmx” web service. This web method requires a couple of parameters (the list name and what gets updated) – now that we have added the “ListName” node which contains the GUID and we have the Add List Item Template XML data connection which describes our data structure we have all the necessary information to add the “UpdateListItems” web method!
Step 6: Add the “lists.asmx” web service
1. Add a new “Submit” type of web service data connection to the “lists.asmx” web service – this is typically located at: http://servername/_vti_bin/lists.asmx
2. Select the “UpdateListItems” operation
3. Double-click the “listname” parameter and assign the “my:ListName” node as the value
4. Double-click the “updates” parameter, select the “Add list Item Parameter” data source, select “Batch” and click OK
5. For the “Include” option select “XML subtree, including selected element”
6. Complete the Data Connection Wizard
Now that we have all the connections that are required, we now need to add the “submit” functionality to the form template.
Step 7: Add Submit functionality
1. Display the Data Source Task Pane
2. From the Data Source dropdown box choose the Add List Item Template data connection
3. Drill down through the data source, right-click on the Field node and choose Repeating Table
We need to change the text box control in the “Name” column to Read-only – if these values were to be changed it would affect the CAML and the submit would fail.
• Double-click on the text box in the Name column of the Repeating Table
• Select the Display tab
• Enable the Read-only property and click OK
• Add a new Button control to the View
• Double-click the button to display the Properties
• Click the Submit Options button
• Enable the option “Allow users to submit this form”
• Enable the option “Perform custom action using Rules” and click the Rules button
• Click the Add button
• Click the Add Action button
• From the Action dropdown box choose “Submit using a data connection”, select the “Web Service Submit” data connection and click OK
• Click the Add Action button
• From the Action dropdown box choose “Query using a data connection”, select the “MyContacts” data connection and click OK (this will automatically refresh the list in InfoPath so you can see the newly added record)
• Click OK until you are back to your form
NOTE: If you want to automatically clear out the submitted values, add another action to this Rule to “Set a field’s value” and the only option you need to specify is the “Field” option – select the “Field” node from the “Add List Item Template” data connection and then simply leave the Value option blank.
Step 8: Test!
1. Click the Preview button to preview the form
2. Fill in values for each of the fields: Title, First Name, Last Name, E-mail and Phone
3. Click the Submit button – the contact information should be submitted successfully and the “MyContacts” list automatically updated!
A special thanks to Matt Faus of InfoPathDev for for initially posting this solution!
Scott Heim
Support Engineer
Comments
Anonymous
March 26, 2007
PingBack from http://www.virtual-generations.com/2007/03/27/sharepoint-2007-link-dump-2/Anonymous
March 27, 2007
Thanks for this fancy reiteration of my post! However, since people have been doing this for over a year now, I think a more helpful post would be on how to get this form to look good. The schema does not allow for very easy representation with standard InfoPath controls. We have discussed possibilities for solutions to this problem in our forums, but an elaborate (and codeless) example form would be stupendous!Anonymous
April 04, 2007
Any ideas how to integrate a dropdown list for any of the sharepoint list fields in the form?Anonymous
April 04, 2007
Hi Gerhard,I am not sure I follow your question. For instance, what I can do is simply add another data connection to the same list and use this connection as the source of values for the dropdown list boxes - does that help?ScottAnonymous
April 04, 2007
Hi Matt,Thanks for your suggestion and again - thank you for the original post!Any way I can ping you offline about your request?ScottAnonymous
April 05, 2007
Hi Scott,Thanks for the article. I followed the steps described in this article. When I click submit I get the message saying "This form was submitted succesfully". But there is no new item in my contacts list. Do you know what I might be missing here?Anonymous
April 05, 2007
The comment has been removedAnonymous
April 05, 2007
well, found the solution. I wrote a windows app to submit data to the same list I was trying earlier and that gave me the required error message.I was getting:The list or view of the list referenced here no longer exists.found the solution to that in this KB article:http://support.microsoft.com/kb/840549Anonymous
April 05, 2007
I am glad you found the cause of the problem!ScottAnonymous
April 14, 2007
This weekend I took some time to research and then test methods to post information from an InfopathAnonymous
April 18, 2007
Hi Scott,My english is very poor! I think you will very difficually to understand the meaning for this quote :>My problem is look like techietex.I can submit the form and show the successful message. But the target list can not be update any information.I double-checked the default GUID value in the ListName and sure this GUID as same as the traget list.Do you have any idea ?? Waiting for your reply.IotaAnonymous
April 19, 2007
Hi!I'm experiencing the same problem as iota and techietex. When I'm submitting my form I recieve a message that tells me that the data has been posted successfully. But of course, no item in the list.I checked the GUID three times just to make sure. And I tried creating a new Team Site with a new List that the form could post to, but still the same result.It's really strange...Anonymous
April 20, 2007
Same thing here, double checked everything and tried it on two different sharepoint systems.I do get the message that everything was submitted, but nothing appears in the list. Any suggestions?Anonymous
April 23, 2007
OK, solved the Problem.Somehow the GUID changes after the creation. I created the List, checked the GUId and tried it with that ID, with no success, then i added something to that list and rechecked the GUID and got another one, after trying again with that GUID it worked.Anonymous
April 23, 2007
The comment has been removedAnonymous
April 24, 2007
Hi everyone,Sorry for the delay in responding - I have been out of the office for the last week.Doubter13 - glad to hear you have resolved the issue! For everyone else, a couple of points to check:If you have renamed the "Title" field to be your own name, the CAML query will still need to reference that field as "Title."Check the Application Event log and see if there are any errors or warnings when you test this process - we could be hitting a permissions issue based on the Application Pool Identity Account being used in the Application Pool for your site ScottAnonymous
May 07, 2007
hi, Scott, doubter13 I try checked GUID for my list. They are correct but no items add to my list. Please, help me. ThanksAnonymous
May 08, 2007
Hi doubter13,I thought you had this resolved? Have you renamed the "Title" field in your list? Are there any errors or warnings in the Application Event log or the server log?ScottAnonymous
May 08, 2007
Hi guys,Could you please help David (galetarconsulting.com) out, he posted a desperate message on my blog because I linked to this article, but he didn't know how to drop a comment here, or to get in contact with you all (I guess there's a need to register and login?). Anyway, here are his questions:In section #3, it says:"1. Create a new, blank, browser-compatible form template"What does it mean by this?How do I do this? In the same section it says:"2. Add a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2.", and "3. Add a “Receive” type secondary data connection to the “MyContacts” SharePoint List created in Step #1"What does it mean by this?How do I do this? Lastly, I need to place this form on the companies "Public" portion of the website (for anyone to fill out), while I collect the data in a "Private" part of the website, or the "Sharepoint" part of it.PLEASE HELP- - - I WOULD REALLY APPRECIATE IT!!!!!!!!!Anonymous
May 08, 2007
Hi,Create a new, blank browser-compatible form template - Launch InfoPath - Click Design a Form Template - Choose Blank and enable the option: "Enable browser-compatible features only"You add data connections to an InfoPath Form Template by selecting Data Connections from the Tools menu and clicking Add. There you can choose whether the connection type is Submit or Receive This is going to be challenging as I am assuming the "public" site is going to allow Anonymous Access. If so, then SharePoint security is designed to not allow any submissions to a library or list with Anonymous access enabled. As such, this process will change as the data will need to be submitted to a custom web service that you create to take the XML and create the list item for you. ScottAnonymous
May 08, 2007
I got items in my list (used file XML and GUID of my list). But I not add item in my list (used web service of sharepoint).Please, help me.Anonymous
May 09, 2007
Hi Cidras,If none of the other suggestions in these comments have been of benefit, then the best option would probably be a support case with Microsoft Product Support Services so this can be looked into further.ScottAnonymous
May 10, 2007
yeah, I added item in my list. Thank you, Scott.Anonymous
May 21, 2007
Am I missing someting?Shouldnt we just add Lists.asmx as the datasource and pass the SPquery? Why do we have to do CAML?Anonymous
May 23, 2007
The comment has been removedAnonymous
May 28, 2007
The comment has been removedAnonymous
May 28, 2007
Thanks!That does clear things out. :)Anonymous
May 28, 2007
Hi,Is it possible to modify the procedure to submit the entire form to a forms library?I know you can submit directly to a forms library, but we have a scenario with anonymous users and since we can not grant anonymous users write priviliges to libraries we need a method of submitting via a web service.CheersaperssonAnonymous
May 29, 2007
Hi apersson,Here is a "sample" web service method for creating a new InfoPath XML file in a SharePoint library. To use this, you would:Create a new Submit data connection in InfoPathPoint the "fileName" parameter to a node in your data structure (obviously you could hard code this as well) For the "fileContents" parameter you will choose "Entire form" and then enable the option: "Submit data as string" [WebMethod] public void CreateInfoPathDocument(string fileName, string fileContents) { try { string pathFolder = "SubmitViaWebService"; //Where the form will be created SPSite site = new SPSite("http://server"); SPWeb web = site.OpenWeb(); SPFolder folder = web.Folders[pathFolder]; if (fileName.IndexOf(".xml") == -1) fileName += ".xml"; string fileUrl = folder + "/" + fileName; System.Text.Encoding e = System.Text.Encoding.UTF8; byte[] b = e.GetBytes(fileContents); SPFile file = folder.Files.Add(fileUrl, b, true); } catch (System.Exception ee) { throw new ApplicationException(ee.Message); } }Anonymous
May 29, 2007
Thanks Scott,Thank you for your fast reply.So this can't be done without coding?CheersaperssonAnonymous
May 29, 2007
Hi,Well - as you have seen, if anonymous access is enabled that anonymous user cannot submit directly to SharePoint. As such, you will need to create a custom web service to handle the submit and create the form - so no - there is no way (that I know of <G>) to do this without writing custom web service code.ScottAnonymous
May 29, 2007
Hi,Yes, I understand that, I just figured that the lists.asmx web service could be used.:) Actually, I think the major problem isn't that anonymous users can't submit to a library. I think the major issue is that for anonymous users to submit to a list you have to give them view priviliges as well.CheersaperssonAnonymous
May 29, 2007
Hi Scott,I tried to follow all the steps you mentioned and encountered no error but when i started to submit the form, i am recieving the following error:InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">The system cannot find the file specified. (Exception from HRESULT: 0x80070002)</errorstring></detail>How am i gonna solve this? Please advise.Thanks,iceeAnonymous
May 30, 2007
Hi icee,Did you try the exact steps I documented? I have not seen this specific error before regarding this process so the first thing to make sure of is that you are following the exact steps - no changes. Then once this sample is working, move forward with your actual scenario.ScottAnonymous
May 30, 2007
This tutorial worked for me. The one thing I ran into and corrected is when setting up the webservice on a teamsite the servername in the following example must contain the full path to the team site you want to create this webservice for.http://servername/_vti_bin/lists.asmxAnonymous
May 30, 2007
I do have a question though. In this tutorial you're only using a CAML template, which is only allowing me to use a repeating table. The repeating table is the exact format as the list form on sharepoint which I'm trying to break away from. Is there any way to design a form the way you want and have the fields send to a sharepoint list. and if not is there any way to have a form update the fields in the CAML list so I don't have to comprimise the look of my form?Anonymous
May 30, 2007
Thanks scott and hunter,i think i made a mistake in the url of the web service, now it submits successfully, thanksAnonymous
May 30, 2007
Hi Scott,When I hit the Submit button I get the following error. I have followed the exact steps as what is in the blog. Can you please urgently help me with this matter.The error is:The data connection MyContacts is using a URL: http://auperadev03:82/sites/ChangeControlPortal/ChangeControlDev03Site/Lists/MyContacts/AllItems.aspxThe error I am getting is as follows:InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">There is no Web named "/sites/ChangeControlPortal/ChangeControlDev03Site".</errorstring></detail>Kind Regardsdarryl2912Anonymous
May 30, 2007
Hi Scott,I figured this one out....Sorted this now....I was selecting the list service of the root site instead of the sub site......darryl2912Anonymous
May 30, 2007
Hi ScottIn submitting the InfoPath form according to your blog, which I now have got it to work I want to be able to also submit with that form an attachment. Do you know how to do this using the CAML approach that you had used in your blog. It must be possible but I do not know how to. Any other blogs or have you got a solution for this as well. What can I place in the xml to get it to work. This would be very handy for us.Kind Regardsdarryl2912Anonymous
June 06, 2007
The comment has been removedAnonymous
June 06, 2007
Hi darryl2912,I am been testing functionality to include an attachment but have not been 100% successful. When I have some time to work on this, I will look at it again and if successful, will modify this post.Zullu,Based on the error, it seems you still have a Permissions problem. Try creating a submit connection in the InfoPath UI to the same library...can you submit without any error?ScottAnonymous
June 06, 2007
I can view the List Item Data in Infopath form as well I can Add the New List Itsm in Sharepoint List through this code. Its working fine.I am looking for the updating existing list Itmes data through this UpdateListItem web service but not able to get through...plz look in to it..thanksAnonymous
June 06, 2007
Thanks for the article. I followed the steps described in this article. When I click submit I get the message saying "This form was submitted succesfully". But there is no new item in my contacts list. Do you know what I might be missing here?Thanks for any help?Anonymous
June 08, 2007
Hi gorpade,Have you reviewed the comments in this post to see if any of them help? A number of folks have received this same behavior and were able to resolve the problem. Make sure the list service you are calling is for the appropriate site.ScottAnonymous
June 12, 2007
Hi zullu,Have you looked at the Application Event Log or the Server logs to see if there are more details to the error? Is this a browser form? If so, you will probably need to change the logging options to Verbose for the Forms Services logging operations.ScottAnonymous
June 13, 2007
How would you handle a repeating table/section with the SharePoint list?Anonymous
June 14, 2007
The comment has been removedAnonymous
June 14, 2007
The comment has been removedAnonymous
June 18, 2007
Hi kaj,Here is some sample code I wrote to simply enumerate the existing contacts returned from the list and subsequently update those same contacts with the new values entered in the table. You could use this as a basis for how to accomplish what you need:public void CTRL26_5_Clicked(object sender, ClickedEventArgs e) { //Create a new instance of our "Lists" web service server.Lists myList = new SubmitToSharePointList.server.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //myList.Credentials = new System.Net.NetworkCredential("user", "password", "domain"); //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["MyContacts"]; //Create a Navigator object so we can enumerate the list XPathNavigator xnContacts = dsContacts.CreateNavigator(); //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create a NodeIterator object to enumerate all of the existing contacts XPathNodeIterator xi = xnContacts.Select("/dfs:myFields/dfs:dataFields/dfs:MyContacts", ns); //Enumerate each existing contact and update the values in each record with the changed information while (xi.MoveNext()) { //Create XPathNavigator objects for each field from our list XPathNavigator xnID = xi.Current.SelectSingleNode("@ID", ns); XPathNavigator xnFirstName = xi.Current.SelectSingleNode("@FirstName", ns); XPathNavigator xnLastName = xi.Current.SelectSingleNode("@LastName", ns); XPathNavigator xnTitle = xi.Current.SelectSingleNode("@Title", ns); XPathNavigator xnEmail = xi.Current.SelectSingleNode("@Email", ns); XPathNavigator xnPhone = xi.Current.SelectSingleNode("@Phone", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); string strOperation = "Update"; //Create the CAML query passing in the value of each of our fields from the form updates.InnerXml = string.Format(@"<Method ID='1' Cmd='" + strOperation + "'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "<Field Name='FirstName'>" + xnFirstName.Value + "</Field>" + "<Field Name='LastName'>" + xnLastName.Value + "</Field>" + "<Field Name='Title'>" + xnTitle.Value + "</Field>" + "<Field Name='Phone'>" + xnPhone.Value + "</Field>" + "<Field Name='Email'>" + xnEmail.Value + "</Field>" + "</Method>"); //Update the list XmlNode node = myList.UpdateListItems("EAD1852F-6884-47B0-B928-BCB167698784", updates); dsContacts.QueryConnection.Execute(); } }Anonymous
June 20, 2007
Excellent work Scott (and Matt).I am a beginner. I got the demo working but have a couple of questions.I would like to essentially implement the solution you have done, except with two changes:1) I would like the ability to customize the look of the form some more, which has been mentioned elsewhere in the thread, including by Matt. So I assume there is nothing new in that regard and will continue monitoring this and other forums.2) I would like to be able to do this with a document library. Everything I find seems to be on how to submit the actual form to the library. What I am attempting is a little bit different from the examples I have found- I want the user to be able to browse to a file to upload to the document library (just like in Sharepoint), to collect all of the other fields I need just as in your list example, and then click submit to create a new entry in the document library with the "browsed-to" file as the file in the document library.FYI- The reason for doing this instead of just the Sharepoint add, in our case, is so I can gain some more control (and provide choices from some different data sources) for their selections for the other columns that will ultimately describe the document.I hope that makes sense. Thanks in advance.presackAnonymous
June 21, 2007
Hi presack,Agreed - it would be nice to have a re-design of the form but I just have not had time to think about this much - sorry.Regarding your 2nd question - is your form designed for the browser for for the client?ScottAnonymous
June 21, 2007
Thanks for the response, Scott.No problem on point one- that's what I figured. I am not far enough along right now in my experience (thus the novice post) to develop a way myself yet.I am currently planning on using the browser-enabled form, but using the client is an option in our environment. All users have InfoPath 2003 SP1.Thanks,presackAnonymous
June 21, 2007
Hi presack,If your preference is a browser form, you may want to look at using a custom ASPX page with the XmlFormView control. This way you can easily provide an option to allow your users to "browse" for a file to upload.Then you could create a web service on your SharePoint server that uses the SharePoint Object Model functionality to grab the selected file and upload it to the appropriate document library. I don't have any sample code on this but you should be able to search around and find something - maybe on a SharePoint BLOG.Here is a link to using the XmlFormView control:http://msdn2.microsoft.com/en-us/library/aa701078.aspxScottAnonymous
June 22, 2007
Thanks again. That looks like a potentially workable solution. Another article I found that may be of interest to people in this thread (although it is not an Infopath solution- sorry!) is below:http://msdn2.microsoft.com/en-us/library/ms916819.aspxIt provides the ability to customize Sharepoint List forms (both the input and the display). It looks to me like it has some drawbacks, but I'm not in a position right now to have the time to implement it. I just thought it was worthy of note.presackAnonymous
July 04, 2007
Hi,I try to complete the “Submitting to a SharePoint List” but I have the same problem that read in your comments “When I’m submitting my form I recieve a message that tells me that the data has been posted successfully. But of course, no item in the list.”. I checked everything again and again but the problem remains. I try the example with Contact List of MOSS (Parent example from Matt Faus) and works (needs a simple change on GUID and Submit button). I try to create my own list (in same site and area with contact list) and run the example but the result was dishearting. I check the settings of two lists (mine and contacts)no difference except field “Title” that included only in my list. Did anybody knows the reason?GiannisAnonymous
July 04, 2007
Hi Scott,in an template example that you given at June 18 to kaj you use"server.Lists myList = new SubmitToSharePointList.server.Lists();"I try it but I cann't find the assembly reference. An idea please.thanks for your help.GiannisAnonymous
July 05, 2007
The comment has been removedAnonymous
July 08, 2007
Hello,How can I create initially automatic file name when the user clicks on "submit" button (at web InfoPath on the ribbon area)?Tools-> submit options-> to SPS '07Sample: "file_" + now() + userNameThank for original post.IshayAnonymous
July 09, 2007
Hello,may be you can give me a hint how to do this:I can insert new items to the list as long as I don't use a field that contains a Person/Group-Field. I think, I need a GUID or something like this for the person-Field - but where can I get the information from?I tested with a GIUD-like value I got from the webservice:userprofileservice.asmx - GetUserProfileByName. But this doesn't work.Any idea what's correct?Anonymous
July 11, 2007
The comment has been removedAnonymous
July 11, 2007
Hello Scott,My scenario is:After I Open a web infopath form and complete all input fields then I submit the new form.now the form is save automatic in sps listHow can I Generate a unique identifier prameter when i create new item on infopath automatically ?(mynane + unique_id() -> save automatically into sps list)T UIshayBAnonymous
July 11, 2007
Hi Ishay,There are a number of ways to create a unique ID:Use a data connection to a database that increments a number and returns that to youUse a web service that does something similar, etc. There is not a built-in way to get the unique identifier from SharePoint since this does not get assigned until after the form has been submitted.Probably the easiest method is to either use a web service that gets the next value from a database or, if you are already using code in your form, you could generate a GUID value and add this to your form name.ScottAnonymous
July 11, 2007
Hi Scott,thanks for your answer. It works fine.It helped me to find the following:Use Webservice UserGroup.asmx - GetUserInfoThe result contains an ID and Name-Node.Concat them to a string like ID;#Name. This is what you have to paste to the field you want to update. This works as well for groups. Use GetGroupInfo instead.Another problem:The name of the column "Assigned To" in the tasklist has a blank in its name. I haven't found a way to update columns with a blank in its name (whatever datatype they have). Any idea how to overcome this?There are lots of columns coming from Microsoft with blanks and I don't want to customize them every time...Anonymous
July 12, 2007
Hi UKaren,I am not sure I follow what you mean by a "blank" in its name. How are you determining this? When I go to my Tasks list and click New, I see the AssignedTo field but when I click in that field I don't have a blank.Sorry if I am missing something obvious.ScottAnonymous
July 13, 2007
Hallo Scott,sorry - for my bad english. on all sharepoint-server I have access to the column name of the AssignedTo field is written as "Assigned To" - between Assigned and To there is a character (Ascii 32). That's what I call "a blank".Anonymous
July 13, 2007
Hi UKaren,Thank you for the clarification - now I understand!In actuality, when you are setting the "Assigned To" column to a value, the underlying column name is "AssignedTo". This appears to be true of most, if not all, of the column names. Even though they show spaces, the actual names do not contain a space.For instance, "Start Date" is actually "StartDate", "Workflow Name" is "WorkflowName".If you ping a SharePoint Blog you may find a better way to determine this - I use this tool:http://www.sharepointblogs.com/mossman/archive/2007/04/11/u2u-caml-query-builder.aspxPlease note this is not a recommendation - merely a tool I use to help build the CAML queries since I am not a SharePoint expert! :)ScottAnonymous
July 17, 2007
UKaren, u can use SharePoint Explorer (latest version which support MOSS 2007) to see the actual values of field names.Anonymous
July 18, 2007
Thank you Scott,Sorry am late to answer you. I have already find the way to do what I asked.I apologies that I thought what you write in your example I must type it as is. I understand later the changes.Thanks again.Anonymous
July 18, 2007
Hi Giannis,That is great to hear! I am glad it is working for you now.ScottAnonymous
July 20, 2007
Hi,Following can be used to get the Unique UserID to be passed in "Assigned to" in the task list.Private Function sGetUserID(ByVal sUserID As String) As String Dim strUserID As String = "" Dim ugp As New WSUG.UserGroup() ugp.Credentials = New NetworkCredential("User", "Pwd", "Domain") Dim NDUser As XmlNode = ugp.GetUserInfo(sUserID) Dim xnrUserInfo As XmlNodeReader = New XmlNodeReader(NDUser) While xnrUserInfo.Read() If xnrUserInfo.Name = "User" Then strUserID = xnrUserInfo.GetAttribute("ID") End If End While Return strUserID End FunctionAnonymous
July 24, 2007
The comment has been removedAnonymous
September 05, 2007
I tried publishing this completed form as a browser enabled content type. The form will launch, but it will not submit. I get an error when I hit submit and the list does not update. I have even added some custom code I found online and have been unsuccessful in making this form work in a browser. Has anyone been able to do it? Regards,Brian-To be clear, the form works perfectly fine when launched from inside the Infopath client, but not from the browser enabled infopath form setup as a content type in a document library.Anonymous
September 11, 2007
Hi Brian,I just tested this process after pubishing my XSN as a Site Content Type and it worked from the browser without issue.If you would, try these steps:Delete the Content Type from the document library where you added the published content typeDelete it from the Site Content Type list Delete the XSN from the saved location Create a new library on the same site called: ContentTypes Publish the XSN as a Site Content Type and save it in the ContentTypes library Add it as a Content Type to your document library Test ScottAnonymous
September 19, 2007
Hi Scott,I am trying to allow anonymous users to submit items to Sharepoint List using "Infopath Form Services" over the browser, but I am facing some issues.In order to achieve this, I have created a web service as you have explained in here:http://blogs.msdn.com/infopath/archive/2007/03/26/submitting-to-a-sharepoint-list.aspx#2969087I can submit the form through infopath as "string as data", but when I try to submit it using form services over the browser, it fails returning an error: "Infopath cannot submit the form".Are anonymous users not allowed to add items to sharepoint list using infopath form services?Also, can this issue (allowing anonymous users to add items to sharepoint list through form services) be overcome with another method?Thanks in advanceAnonymous
September 20, 2007
Hi Deniz,Chances are this is a login/permissions issue. When you use the InfoPath client you are coming in as that logged on user; however, when using the browser you will be trying to create the form as the identity specified in the Application Pool for your site.Have you taken a look at your server logs? Reproduce the error, then open the latest server log, scroll to the bottom and then do a search "up" for Forms Services - you will probably find an error regarding authorization, permissions, etc.ScottAnonymous
October 03, 2007
The comment has been removedAnonymous
October 07, 2007
Hi there,This post has helped me a lot, but I can't figure out how to retrieve and update a specific list item. I need to be able to click a link in a sharepoint item list, that will open the Infopath form used to edit that item and do the necessary processing, and then save the changes to that specific item.It sounds like it should be easy enough!Thanks,GarthAnonymous
October 08, 2007
Hi Garth,Unfortunately it is not as easy as it may seem. The only way I have found to do this is to custom code because you need to be able to modify the CAML query to tell it what type of edit you are doing (i.e. New, Delete, etc.) and then for which item in the list.Using the steps in this sample, I have modified the table structure returned from the list to add a new column. This column simply holds a button that would be used to "update" the data in that row. Here is some sample code that I have used to accomplish this:On the click event of this button, I have just this code:UpdateList("Update", e.Source.CreateNavigator());Here is the "UpdateList" procedure:public void UpdateList(string strOperation, XPathNavigator e) { //Create a new instance of our "Lists" web service serverName.Lists myList = new serverName.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["MyContacts"]; //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create XPathNavigator objects for each field from our list XPathNavigator xnID = e.SelectSingleNode("@ID", ns); XPathNavigator xnFirstName = e.SelectSingleNode("@FirstName", ns); XPathNavigator xnLastName = e.SelectSingleNode("@LastName", ns); XPathNavigator xnTitle = e.SelectSingleNode("@Title", ns); XPathNavigator xnEmail = e.SelectSingleNode("@Email", ns); XPathNavigator xnPhone = e.SelectSingleNode("@Phone", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); //Create the CAML query passing in the value of each of our fields from the form if (strOperation == "Delete") { updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Delete'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "</Method>"); } else { //Create the CAML query passing in the value of each of our fields from the form updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Update'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "<Field Name='FirstName'>" + xnFirstName.Value + "</Field>" + "<Field Name='LastName'>" + xnLastName.Value + "</Field>" + "<Field Name='Title'>" + xnTitle.Value + "</Field>" + "<Field Name='Phone'>" + xnPhone.Value + "</Field>" + "<Field Name='Email'>" + xnEmail.Value + "</Field>" + "</Method>"); } //Update the list XPathNavigator xnListGUID = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ListName", ns); XmlNode node = myList.UpdateListItems(xnListGUID.Value, updates); //Requery the data source to reflect the updates dsContacts.QueryConnection.Execute(); }As you can see, this code can also handle a "Delete" submission as well.ScottAnonymous
October 09, 2007
Hi Scott,Thanks for the reply! How do I open an Infopath form, from a Sharepoint list item (e.g. by clicking on an icon)? I assume I can put the form into a Sharepoint webpart? And, is it possible to pass a parameter to that form, that I can use in one of it's fields?Thanks,GarthAnonymous
October 09, 2007
Hi Garth,Not sure I follow the first question...are you asking how to click on a SharePoint list item and that will open an InfoPath form? If so, I am not sure how you would accomplish this - a Content Query Part may be the answer.In regard to the parameters question, take a look at this blog post:http://blogs.msdn.com/infopath/archive/2007/02/26/passing-data-into-a-form-input-parameters.aspxScottAnonymous
October 14, 2007
The comment has been removedAnonymous
October 15, 2007
Hi Garth,Unfortunately, I am not a workflow expert. In fact, with the group I am with (InfoPath support) we see very little of the workflow issues as they are primarily handled by our SharePoint folks (at least from an Office workflow perspective.)I don't mean to dance around your question but I don't want to steer you in the wrong direction. Have you seen the SharePoint/Workflow blog: http://blogs.msdn.com/sharepoint/archive/tags/Workflow/default.aspx ?You may want to post here and see if you can get some better direction.Now, what I am wondering is this: you mentioned that you are currently doing this with "Content Types." You can certainly publish an InfoPath Form Template (XSN) as a Site Content Type as well. Without knowing exactly how you are launching the content types, I wonder if this would provide any benefit? With this being an InfoPath Form Template simply published as a Content Type you can certainly manipulate the data the same way as if you published the form as any other type.ScottAnonymous
October 18, 2007
I am new to InfoPath. I tried this and it worked perfectly. Can you elaborate on your response dated in April about integrating a dropdown column in a sharepoint list with infopath? It would be great if you could list the key steps. Thanks!Anonymous
October 19, 2007
The comment has been removedAnonymous
October 19, 2007
The comment has been removedAnonymous
October 19, 2007
Hi Scott,Thanks for taking time to check on it.I resolved the issue i am having. When we add a web reference to the lists web service, we need to include ?wsdl at the end. So it has to be something like http://server/site/_vti_bin/lists.asmx?WSDL.I didnot include that initially. I included that now and its working fine.Appreciate your help and thanks for posting this article.-jrk555Anonymous
October 19, 2007
Hi jrk555,Excellent! Glad you have this working...ScottAnonymous
October 22, 2007
Hi Folks,I have followed the exact steps as mentioned above but i am getting the message "The form was submitted sucessfully" but actually the item is not added into the list. I have ensured the correct GUID. I can see that many people have faced the same problem so hoping to get the exact solution of this problem...Hope to get the response soon.Thanks and Regards,SAnonymous
October 22, 2007
Hi Guys,Could anybody reply me about my problem? I will appreciate if someone could. I am stuck with that as i am not able to inserting item into list even after following the above steps...Thanks a lot in advance...My mail id is software.sanjay@gmail.comThanks,Sanjay.Anonymous
October 22, 2007
Hi Sanjay,Make sure you are referencing the correct "Lists.asmx" web service. For instance, if your list is at http://server/lists/list_name then the web service you will want to use is http://server/_vti_bin/lists.asmx; however, if your list is at http://server/site/lists/list_Name then the web service you need to use is http://server/site/_vti_bin/lists.asmx.ScottAnonymous
October 23, 2007
Hi Sanjay,Please excuse my lack of SharePoint knowledge here...but have you tried:http://servername/SiteDirectory/SanjaySite/_vti_bin/lists.asmxScottAnonymous
October 23, 2007
Hi Scott,There is no lists.asmx file at the URL http://servername/SiteDirectory/SanjaySite/_vti_bin/lists.asmxThanks and Regards,Sanjay Patel.Anonymous
October 23, 2007
What is "SiteDirectory" in your URL? Is that a site or something else? For instance is http://servername/SanjaySite the same as http://servername/SiteDirectory/SanjaySite?ScottAnonymous
October 29, 2007
Hi Scott,Since it is not possible to rename the "Title" field in the CAML file, is there a way to hide it? I would like to create an InfoPath form that links to an existing list and I would like for users not to see the "Title" field when they fill it out.Greatly appreciated!Anonymous
October 31, 2007
The comment has been removedAnonymous
November 01, 2007
Thanks Scott, it works!! My next question (and i think i might have the answer to this already, but I just wanted a confirmation) is if I want to point to a list that already exists, and the Title field has been renamed, is it possible to still link to it?I am assuming the answer is no, because I tried, with no success (I am guessing that one of the columns is the title field, I did not try all of them).Thanks again!Anonymous
November 01, 2007
Hi shakes11,Chances are it was just the "caption" that was changed - the underlying name of the field is probably still "Title."ScottAnonymous
November 28, 2007
Hi Leary,I too spent some time trying to get this to work in a similar fashion as the "add" but kept running into issues...and then ran out of time to continue working on it.The way I do this now is to use custom code - there is a sample earlier in this post.ScottAnonymous
December 03, 2007
Hi Team,I have followed every step in this article. I receive this error:" An error occured while the form was being submitted."Thank you.Anonymous
December 03, 2007
OK, Please ignore the above post. I am getting a new error.Records were submitted. But I am not seeing it in the list.Thank you.Anonymous
December 03, 2007
OK, Please ignore the above post. I am getting a new error.Records were submitted. But I am not seeing it in the list.I checked the GUID. Nothing was modified.Thank you.Anonymous
December 03, 2007
I made even more progress...When I add a new task in the list via Sharepoint it loads in the Infopath form.When I try to add records to Sharepoint via Infopath. It does not work. Do you have any idea as to why this is not working.Thanks.Anonymous
December 03, 2007
Hi paras2020,A couple of things to check:Make sure you are using the correct "lists.asmx" web service for your siteMake sure the fields you reference in the "Add List Item Template.xml" file contain valid fields that actually exist in the list. ScottAnonymous
December 03, 2007
BTW....is there a math function in Infopath which an create a random as the form loads. Sorry for going off topic.Thanks in advance.ParasAnonymous
December 03, 2007
The comment has been removedAnonymous
December 03, 2007
In the rules for the Submit button this is what I have:Submit using a data connection: Web Service SubmitQuery using a data connection: Add List Item TemplateAnonymous
December 03, 2007
In the future I am going to be pulling in data from active directory to pre populate this fields. How would I do with a repeating table?? PLease advise.Anonymous
December 03, 2007
I am using the method UpdateListItems in the web service. Thanks.Anonymous
December 04, 2007
Hi Scott,I also have the list I pointing to is workflow enabled....could that be causing the problem? ThanksAnonymous
December 04, 2007
Is there away to adopt cascading menus to this infopath form??Thanks.Anonymous
December 04, 2007
Hi Guysthanks for the great post, really helped a lotIf you can shed some light on how robust this method it.For example if I add a new column to the list, and recreate my xml file, the sumbit function stops to work, it will give you that " form successfully submitted" but there are no entries in the list.Also I have faced that this method works on one list and not the other, both the lists are done up exactly the day way.Can you please suggest any ways to make the infopath form control datatype compatible with lists.Anonymous
December 04, 2007
Hi Scott, I'm trying to update a sharepoint list field and I followed all the steps, but it doesn't write the sharepoint list.There's no error or messages: it's simply not writting the data.Is there a reason for that?Thanks!Anonymous
December 05, 2007
One observation I had was that I needed to construct a custom list...and make the field names exactly as the AddListItemTemplate.xml...I was unable to submit to a OOTB MOSS Contact list...any suggestions???? tho - what if I want to submit a batch of say 350 items to the list? How do you construct the AddListItemTemplate.xml so that you can add additional items? (I'll actually populate my 'submit list' from a sql table-selectively)Anonymous
December 05, 2007
The comment has been removedAnonymous
December 06, 2007
Hello everyone,I have been extremely busy lately with support issues so I will try to address your questions as soon as possible.ScottAnonymous
December 17, 2007
Here is a support file that works with OOTB Contact list...with an additional field added as well...using 2 fields in the support file to get the field names to appear as I need...base field names for the submit don't change...just only display the 'DiaplyName' on th IP form...still want to submit multiples????<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New">
<Field Name="Title" DisplayName = "Last Name"/> <Field Name="FirstName" DisplayName = "First Name"/> <Field Name="FullName" DisplayName = "Full Name"/> <Field Name="Email" DisplayName = "E-mail Address"/> <Field Name="Company" DisplayName = "Company"/> <Field Name="WorkPhone" DisplayName = "Business Phone"/> <Field Name="HomePhone" DisplayName = "Home Phone"/> <Field Name="WorkFax" DisplayName = "Fax Number"/> <Field Name="WorkAddress" DisplayName = "Address"/> <Field Name="WorkCity" DisplayName = "City"/> <Field Name="WorkState" DisplayName = "State/Province"/> <Field Name="WorkZip" DisplayName = "ZIP/Postal Code"/> <Field Name="Comments" DisplayName = "Notes"/> </Method></Batch> <Field Name="Account" DisplayName = "Account"/>
Anonymous
December 17, 2007
Hi everyone,Let's see if I can address some of these questions:paras2020: After adding the connection to your list, extract the files from your XSN (File -> Save as source files), open Manifest.xsf in Notepad and look at the SharePoint field names in this file...do they match exactly what you have in the embedded XML file? mayankagarwal: Do the same steps noted above for paras2020 to make sure the names match. Also - review the comments from this blog...there are a number of other things you should confirm that have been discussed here previously. GLazkano: Have you reviewed all the comments in this blog? There are a number of things to confirm: using the correct lists.asmx web service, insuring the field names in your XML file are spelled identical to the columns in your list, making sure there are no fields in your XML file that do not exist in your list, etc. sowmyasimha: So far, I have not been able to get rich text type fields to work. I have not spent much time trying to find a workaround...if there is one. Unfortunately I have just not had time. For everyone that wants to submit multiple items: there may be a way to do this without code but I have not had any time to look into this. Currently the only way I have tested is with custom code: have a repeating node (i.e. a repeating table) on your View and use custom code to loop the items and add them to the list bu specifying the CAML query in your code. ScottAnonymous
December 19, 2007
Thanks for your reply.I reviewed all the fields, all the things that could be wrong, and everything is ok. If I change or modify the fields to another one it fails, but in my case it doesn't fail, it only doesn't do anything.I reviewed the list.asmx and I'm using the correct list.I'm really confused.Anonymous
December 20, 2007
Hi GLazkano,Do the column names in your SharePoint list contain any spaces? If so, then chances are the actual name is something like this in the connection: Test_x0020_Field.However, if this is not the case then I would encourage you to open a support incident so someone can look into this further for you.ScottAnonymous
December 25, 2007
Hi,The name of the sharepoint field I was trying to modify contains a space, but I changed it today and the field is now "Stock_virtual".I've been working on it the entire morning, but it doesn't work.How can I open a support incident?ThanksAnonymous
January 02, 2008
Hi GLazkano,You can either call 800-936-5800 or start a support request here: http://support.microsoft.com/gp/assistsupportI know I keep harping on this <G> but make sure you have checked the following:Your XML file does not contain any additional fields than what you have added as columnsThose fields are spelled exactly as they are from SharePoint (to verify this, use the Save as Source Files option from the File menu and look at the field names in the manifest.xsf file) You are using the lists.asmx web service for the appropriate site you are using You have specified the correct list GUID Make sure this article does not apply: http://support.microsoft.com/kb/840549 Have you renamed the "Title" field in your list? If so, this will still need to be referenced as "Title" in your XML file. Are there any errors in the Application Event log after submitting the data? ScottAnonymous
January 15, 2008
I tried this and it works well.However, I found out the hard way that I can only have 5 fields on the list. Also, you cannot have special characters or spaces on the field name.Anonymous
January 15, 2008
Ignore my comment about having maximum of 5 fields. InfoPath arbitrarily rename my 5th field. Checking the manifest.xsf do not the correct names between sharepoint list and name specified on the XML. InfoPath truncates the field name if it's longer than 33 characters.Very strange!Anonymous
January 21, 2008
Hi coleruiz,Glad to hear you were able to resolve the issue!ScottAnonymous
January 22, 2008
In the current senario I want to add some additional functioality :I want to submit file attachment to the list library using this InfoPath form.Please reply asap who is aware about how to do this.Thanking all of our memberGopalAnonymous
February 01, 2008
The comment has been removedAnonymous
February 01, 2008
Hi Jdaskalis,I have not been successful in implementing this functionality without writing code - if this is of interest to you, let me know and I will post the sample code.ScottAnonymous
February 07, 2008
Hello! And thank you for the post, it's exactly what I've been looking for (and very detailed)!I've followed the instructions exactly as listed and I am getting a SOAP error. My form retrives data (that I've entered via Sharepoint) just fine, but it will not submit data via the form to my SharePoint list.The error is..."List does not exist""The page you selected contains a list that does not exist. It may have been deleted by another user. Click "Home" at the top of the page to return to your Web site."I've checked, double-checked, and rechecked again the GUID, etc.I even went as far as create a new SharePoint site just for this test and restarted your steps. And once again I get the error. I also had the admin restart the server last night.... still no luck.If it matters, I am using InfoPath 2007 and connecting to SharePoint 2003.Anonymous
February 07, 2008
Ok, here's another question...Is there a way to do this without an XML (CAML) file? That way the form is all "self-contained" in a single file?Anonymous
February 07, 2008
It figures I found my own solution right after I submit the question about the SOAP error. It appears I had the wrong Web Service listed. Since my site is a sub-site, I needed to use that service and not the one for the main (root) site.I was using... /myServer/_vti_bin/lists.asmxand should have been using... /myServer/sites/mySiteName/_vti_bin/lists.asmxThanks again for the great example!Anonymous
February 07, 2008
Hi Gmann001,I am glad you were able to get this working! Yes - you can do this without the XML CAML file - this was needed just to be able to add to a list without code. If you don't mind using code, you don't need this file. Look through the past comments here and you will see some sample code I provided for updating list items - this can also be used for adding items as well.If you prefer to stay with the no code solution then that XML file is needed but keep in mind, it is indeed part of the solution - everything is in the one XSN file.ScottAnonymous
February 07, 2008
Scott,I have followed the process you have created. I hit the send button infopath states everything is working correctly. But everything is NOT working correctly. The only Where on a server would be a error log for SharepointAnonymous
February 07, 2008
Hi ArthurM,Please make sure you review all comments in this post. A number of folks have run into the issue of getting a "successful" message and then nothing appearing in the list. There are a number of reasons why this may occur and that information is throughout this post.ScottAnonymous
February 08, 2008
Hello again! When looking at the post from October 19 (your sample code), I am unsure how "Create a new instance of our "Lists" web service"Your code states..server_Lists.Lists myList = new SubmitToSharePointList.server_Lists.Lists();Since I am a starting VB programmer (due to company restrictions), my converted code looks like..Dim myList As server_Lists.Lists = New SubmitToSharePointList.server_Lists.Lists()It shows that there is no such thing as "server_Lists". Am I missing something here? Should I not be taking your code verbatim? Is there something that I need to import/using (i.e. Imports System)?I have a feeling this is a dumb question, but I am new to this and I'm having a heck of a time figuring it out.Thanks againAnonymous
February 12, 2008
Is there a way that I can create a form that doesn't display the fields via a repeater table? I need to create a form that has the look/feel as dictated by our legal department and unfortunately that look/feel is not a vertical table. I need some fields horizontal to each other and I am required to place some text between other fields.Basically I have a custom form that I would like to apply this method to. Any help would be great...thanks!Anonymous
February 19, 2008
Hi Gmann001 - in regard to the "lists" web service you will need to add a web reference to your code that points to the web service.For the layout question - yes, what you can do is add a repeating table to your form with the appropriate fields. Then you will use code to either populate the fields in the Add List Item Template.xml file or simply build the CAML query in your code.If you review some of my past comments, there is sample code for updating a list item - this is the same basic premise you would use for adding one as well.ScottAnonymous
March 13, 2008
Hi there. I have a question which I hope someone can help me with.What I would really like to do is to display two tables.Both tables would display the items included in the SharePoint list (e.g.: the MyContacts list in the example above).However, table 1 would show only items where the Boolean column MyColumn equals 0.Table 2 would show only items where the Boolean column MyColumn equals 1. Plus, for each row there would be a checkbox.Upon submitting the form, for every item ticked in table two would update the MyColumn column in SharePoint. Thus updating the list of TABLE 1.Is this possible to be done, without coding? I am a little bit rusty with InfoPath these days but I think this could be possible with the use of filters and conditionals?Thank you a lot in advance!Regards,P.Anonymous
March 14, 2008
The comment has been removedAnonymous
March 17, 2008
A good post for anyone starting to use InfoPath.Anonymous
April 13, 2008
Nice Post.i works perfectly.but how can i use other field types(drop-down menu, people and groups, etc...) in this info path form ??i used this post in Task list and it works just fine, but "Assigned to" field in the form i write numbers not names to get a result !!!i think this is the id of the users or groups.how can i get users from my domain in assigned to field ??appreciate any help.Anonymous
April 14, 2008
Hi saefeldin,You are correct - you will need to pass in the SharePoint ID of the user so that it will resolve to the domainuser value. The only way I know of to do this is to either write the code behind InfoPath or create a small custom web service that takes the domain name and returns the SharePoint User ID. Here is a sample web service that I have used to get this information; however, it is important to note that in doing this I have only been successful in using code behind InfoPath to add tasks - in other words, this is not a codeless solution:[WebMethod] public int GetUserID(string strSite, string strDomainUser) { if (strDomainUser != "") { SPSite site = new SPSite(strSite); SPWeb web = site.OpenWeb(); SPUser user = web.AllUsers[strDomainUser]; return user.ID; } return 0; }If you review prior comments you will see sample code I have provided to "update" existing contacts. This is the same basic code that would be used to "add" a new task programmatically - you would just need to incorporate something like the above so you can set the "AssignedTo" field to a valid SharePoint ID.ScottAnonymous
May 09, 2008
The example above worked great but now I want to create a CAML for my list and I can not get it to work unless I use the CAML created in the example above. My CAML looks like the following. Do yoiu know why. I have started from scratch with a new form and a new custom list.<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name='Title'></Field> <Field Name="TaskNo"></Field> <Field Name="TaskDescription"></Field> <Field Name="ProcurementTravel"></Field> <Field Name="LaborEstimate"></Field> </Method></Batch>Anonymous
May 09, 2008
Hi m181354,You will want to verify the following items:Your list GUID is correctYour "Lists.asmx" web service data connection is referenced at the correct level (i.e. http://server versus http://server/site) Your XML file does not contain any additional fields than what you have added as columns Those fields are spelled exactly as they are from SharePoint (to verify this, use the Save as Source Files option from the File menu and look at the field names in the manifest.xsf file) Make sure this article does not apply: http://support.microsoft.com/kb/840549 Have you renamed the "Title" field in your list? If so, this will still need to be referenced as "Title" in your XML file. ScottAnonymous
May 09, 2008
My manifest.xsf file has the wrong Sharepoint names in them but the correct Infopath names. I have the right GUID and the correct "Lists.asmx" web service data connection. I do not know why the Sharepoint names still match the names fom the example above. See below<xsf:dataObject name="JDAM Task List" schema="JDAM Task List.xsd" initOnLoad="yes"> <xsf:query> <xsf:sharepointListAdapter siteUrl="<a rel="nofollow" target="_new" href="https://tcc.web.boeing.com/jdam/JDAM/"">https://tcc.web.boeing.com/jdam/JDAM/"</a> sharepointGuid="{0F7220FC-E894-4523-9043-6F6B367A339F}" infopathGroup="JDAM_Task_List" queryAllowed="yes" submitAllowed="no" name="JDAM Task List"> <xsf:field sharepointName="Title" infopathName="Title"></xsf:field> <xsf:field sharepointName="FirstName" infopathName="Task_No"></xsf:field> <xsf:field sharepointName="LastName" infopathName="Task_Description"></xsf:field> <xsf:field sharepointName="Email" infopathName="Procurement_Travel"></xsf:field> <xsf:field sharepointName="Phone" infopathName="Labor_Estimate"></xsf:field> </xsf:sharepointListAdapter> </xsf:query> </xsf:dataObject>
Anonymous
May 11, 2008
Hi m181354,What you may want to try is deleting the connection from Tools -> Data Connections and then re-adding that connection back. I don't know that I have ever seen that behavior before where the XSN did not pick up the correct fields - that is odd.ScottAnonymous
May 15, 2008
Hi Scott,I am trying to follow the steps you have included in your article and am having a problem with #4 in Step 6: Add the "lists.asmx" web service. When I double-click the "updates" parameter, I see the same thing listed as for the "listname" parameter and not the "Add list Item Parameter" data source as is specified in #4. Do you have any idea as to what I have done wrong?Thank you.Anonymous
May 16, 2008
The comment has been removedAnonymous
May 20, 2008
I got it Scott! Thank you so much for your help and your excellent article!!!Anonymous
May 20, 2008
Excellent! :)ScottAnonymous
June 05, 2008
Hi Scott,Thanks for the info on this, but I am still struggling. I am a victim of the successful submit but no data issue.I can get the example to work no problem, so I have moved on to my own form (a purchase order form).This form contains a series of fields, and a repeating table. The information outside of the repeating table is to be submitted to "list1" and the data inside the repeating table is submitted to "list2". The code for submitting the 2 lists is identical (bar variable names), and list1 is submitted before list2.List2 works without error, but no matter what I do I can't get list1 to work. I have verified the GUID, the webservice path, the defined fields in the XML and the spelling and case. The MS KB does not apply to me. I have compared my list1 and list2 and found no difference in the way they are set up.None of the field names have spaces, but when I check the manifest.xsf I can find the references to the fields but all of them have spaces in them. This is true for both list1 and list2 !?! Can you provide a little more info regarding the manifest.xsf and how to correct problems if they are found? I take it I can't just edit the file and save it back?I have been at this for 3 days, and I am at a loss. If it was not for the fact that one list works but the other does not, I would have thought it was me.Thanks againAnonymous
June 10, 2008
Hi alpha_geek,Are you using code or just the default "add" like the sample? Also - can you describe your data source and lists and let me try to repro?ScottAnonymous
July 03, 2008
Hi Scott,Brilliant article, worked perfectly for me. The next thing I want to do however is combine this infopath submit function with the data gathered from the users MOSS profile (This Article: http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-2D00-Get-the-current-user-without-writing-code.aspx )Basically what I need to be able to do is to collect users infomation from MOSS (no problem) and then submit that same infomation back into a sharepoint list, with some additional user input fields.Any idea how I might be able to achieve this?Anonymous
July 07, 2008
Hi callumbundy,You will need to get the data from the User Profile into fields in your main DOM. If you only return information for one user then you could use either Rules or the Default Value property to pull the data from the User Profile result into your main DOM. Then I would expect it to be basically like the sample...unless I am missing something?ScottAnonymous
July 07, 2008
Hi callumbundy,You will need to get the data from the User Profile into fields in your main DOM. If you only return information for one user then you could use either Rules or the Default Value property to pull the data from the User Profile result into your main DOM. Then I would expect it to be basically like the sample...unless I am missing something?ScottAnonymous
September 11, 2008
Scott,Thanks for your help so far. I am looking to attach the .xml file that would be generated on a "Submit to Sharepoint Document Library" to the list item that form generates. How would I go about doing that? I can use theXPathNavigator myNavigator = this.MainDataSource.CreateNavigator();string wholeXML = myNavigator.OuterXml.ToString();to get the XML representation of the form. I'm just not sure how to make it an attachment on the Sharepoint list.Thanks in advance,AndrewAnonymous
September 11, 2008
Hi Andrew,Unfortunately I don't know how to programmatically create a SharePoint list attachment. You may want to ping one of the SharePoint blogs as this is not InfoPath specific. For instance, you could really just write some code behind a Windows form that grabs an XML file and now you need to att this as a List attachment.I am sorry I don't have a better option for you.ScottAnonymous
September 14, 2008
Hi Scott,Thank you for this great demo. I have used it in a purchase request form to populate a vendor drop-down. It works great. Now I would like to use the same idea to update an Expense number field. I want to take a field that is automatically populated upon opening the form and send it to a different sharepoint list. Rather than opening a form that I need to fill in, can I send an already populated field to a sharepoint list? It seems like it should be easy to do, but I havent figured it out yet.ThanksHollyAnonymous
September 14, 2008
Hi Holly,Before I address the question, I need to be sure I understand what you need: so you open an InfoPath form and upon opening, some field is automatically populated. When you then submit that form to a list, you also want to submit just that auto-populated field to another list as well?Am I understanding correctly?Thanks,ScottAnonymous
September 15, 2008
Hi Scott,Yes, except that I want the field to be sent to the list immediately after the field is populated. I have my purchase request form and a secondary sharepoint list called PR# with a field called eNumber. Right now I am using the following to populate a field upon opening the form;max(eNumber) + 1 I would like the next rule to immediately submit the number back to the PR# list so that it is available the next time the form is open. Basically an autonumber.ThanksHollyAnonymous
September 15, 2008
Hi Holly,OK - Based on my understanding, I have this working, I believe, as you need. Here are the changes I made to my sample XSN:Created a new "Add List Item Template" XML file like this:<Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name='Title'></Field> <Field Name="eNumber"></Field> </Method></Batch>Saved this as: Add List Item Template_PRNumber.xml"Created a new "Receive" data connection to this XML file, chose to include this as a Resource file and set this to retrieve the data when the form opens Added another "Receive" data connection to my PRNumber list and included the "Title" and "eNumber" fields Added a new field to my main data source called: ListName_PRNumber and set the default value of this to the list GUID of my PRNumber list (same steps as when you set the "ListName" field from this sample) Added a new "Submit" data connection just like the one in the sample except I am using the "ListName_PRNumber" field for the ListName and the "updates" parameter points to the "Batch" node from my new Add List Item Template_PRNumber file Now, for the field in my main data source that is to store and display the incremented number, I am not using the "default value" for this field - I am using a Rule on the form open so that this will only fire if that field is blank. So if the field is blank, I have the following actions:Set a field's value - Field: field in my main data source to store the new value - Value: max(@eNumber) + 1Set a field's value - Field: this is the "Field" node from the Add List Item Template_PRNumber connection (not the "name" field - just select the "Field" repeating node) - Value: I selected the field from the above step that stores the new value NOTE: When setting the above "Field" it is going to set both the eNumber and Title fields to the newly incremented value. There is no getting around this unless you use code. For my sample, this is fine...it just means the title is the same value as eNumber.Submit using a data connection - The data connection is the new submit connection back to the PRNumber listSo in my testing, when I double click the XSN, the field in my main data source is blank so the Rule kicks off and sets that value to the max value from the PRNumber list + 1. That rule then sets the "Field" node in the new Add List Item Template_PRNumber connection to this newly incremented value and submits it back to the PRNumber list.I do have some concerns about this method: if you have a lot of new forms being created, then this list is going to get big relatively quickly. I am not a SharePoint expert so you may want to see if there will be a performance issue if the PRNumber list grows to, say, 1000-2000 items.I hope this helps!ScottAnonymous
September 15, 2008
Hi Scott,It worked like a charm. I will be setting up a workflow to clean up the enumber list after it reaches 100 since I only need it for the autonumber feature.Thank you very muchHollyAnonymous
September 15, 2008
Hi Holly,That's great to hear!ScottAnonymous
September 16, 2008
Hello Scott,Thank for your article it's really great.I tried you method on the simple list and it works, but when I try to use it on the task list it doesn't work. Publishing is successful, but the item doesn't appear. Is there any difference between list and task, as I know task is list to.Thanks in advance!Anonymous
September 16, 2008
The comment has been removedAnonymous
September 16, 2008
Hi Scott,Thanks a lot it was great help!!!Anonymous
September 16, 2008
Hi levar,Glad to help!ScottAnonymous
September 29, 2008
Hidoes this work with Windows sharepoint services 3.0 Also ?NarsinhAnonymous
September 29, 2008
Hi Narsinh,I've never tried on a WSS only server but I don't believe there is any reason why this would not work...assuming the "lists.asmx" web service is a part of WSS.ScottAnonymous
September 29, 2008
ScottI had followed every thing mention you above article .but not new item doesn`t add to list . where if I add manually new Item it does Query and able to see thatany helpNarsinhAnonymous
September 29, 2008
Hi Narsinh,I know there are a lot of comments on this post but have you gone through all of these? There are a number of reasons why the entry may fail to appear and most of these have been covered in these comments.ScottAnonymous
September 30, 2008
Hi ScottIS any where logs get generated to check out what getting wrong .Actually I wants create few forms new joinees which get mail to resptive group as well as store inform store in listso that same can be used various places .I had tried with your example but it just message it got submitted but does show item in the listPls helpNarsinhAnonymous
September 30, 2008
Hi ScottGreat news it work your sample list for me on old test site. it seems there some problem with title flied.Thanks for you artlicle .will trouble if need any help for actuall site implementationThanksNarsinhAnonymous
September 30, 2008
Hi Narsinh,I don't believe this is logged anywhere in SharePoint. Did you actually look through the various posts on this site? There are various reasons why you are seeing this behavior and I personally have seen and covered those here in this post.ScottAnonymous
October 13, 2008
Hi Scott,Thanks for the helpful article and following up on the postings. I have completed the fields but have the following issue.My submit fires correctly and creates a row in the sharepoint list. It however is completely blank. None of the data is carried from the form into the SP list.Any Ideas??An InfoPath NewbieJeffAnonymous
October 14, 2008
great post, it worked the first time. Is it possible to show the field description in the infopath form? How would I define this in the xml?thank you!suzAnonymous
October 15, 2008
Hi Jeff,A few things to check:Make sure your XML file contains only those column names you added - if there is a column in the XML file that does not exist it will cause a problem.Make sure the names you specified are spelled correctly (including capitalization) With the columns that you added in SharePoint - did you include spaces in the name? If so - it's not as simple as just adding spaces in the name in your XML file (to see how the names come into InfoPath, create a new XSN with a receive connection to your list. Then from the File menu choose Save As Source Files and look in the manifest.xsf file.) Suz - glad this has worked for you! In regard to how to get the "Description" field - oddly enough the actual SharePoint name of this field is: "Body" - with a captial "B." This is what you will need to add to your XML file. :)ScottAnonymous
November 04, 2008
Sorry to repost since I have not seen the first message I posted yesterday...I got an error message saying the GUID should be 32 digits with 4 dashes. And, I double checked the GUID in the URL of the SharePoint list and it was way more than 32 digits and has 5 dashes.Any thoughts? Thanks. -ETAnonymous
November 05, 2008
Hi ET,It sounds like you may be using the "encoded" version of your list GUID. Here is what you need to do:Navigate to your listFrom the Settings button choose List Settings You should see something like this in your address bar: List=%7B1E76517B%2D2C36%2D4473%2DA420%2DA737D98589BC%7DWhat you want is the portion after "List="%7B1E76517B%2D2C36%2D4473%2DA420%2DA737D98589BC%7DNow, you need to "decode" this GUID as follows:%7B = {%7D = }%2D = -So if you replace the encoded characters as described, you end up with this, which has 32 characters and 4 hyphens.{1E76517B-2C36-4473-A420-A737D98589BC}ScottAnonymous
November 11, 2008
HelloIn my form library, I am have enabled - email enabling list, where user email infopath form and it automatically adding in to form library. It is working very nicely. Now I want to extent this feature for some users where user will mail an XML file in different format which is not same as form library have. I want to transform their XML into infopath XML format. I just need a way to accept the XML and then use the XSLT to create a the form in predefined form template on MOSS and upload it to the SharePoint site.Is this possible?DishaAnonymous
November 11, 2008
Hi dishaniti,Just a thought: either create code on a SharePoint event handler to do this or create a custom web service that takes the XML, performs your modifications to the file and then pushes the "fixed" file back to the library.If you need direction on using a SharePoint event handler I would encourage you to post that request to a SharePoint forum or blog as I don't want to steer you in the wrong direction. :)ScottAnonymous
November 17, 2008
The comment has been removedAnonymous
November 18, 2008
The comment has been removedAnonymous
November 19, 2008
Hello,I have created this form and it works fine within infopath but when it is published to a document library it will open and retrieve data but throws an error when it is submitted.This is just a generic error.Can any one help????????Anonymous
November 19, 2008
Just an update to my above comment i have also tried this suggestion but it gave the same error.Tuesday, September 11, 2007 4:01 PM by infopathHi Brian,I just tested this process after pubishing my XSN as a Site Content Type and it worked from the browser without issue.If you would, try these steps:Delete the Content Type from the document library where you added the published content typeDelete it from the Site Content Type list Delete the XSN from the saved location Create a new library on the same site called: ContentTypes Publish the XSN as a Site Content Type and save it in the ContentTypes library Add it as a Content Type to your document library Test ScottAnonymous
November 20, 2008
Hi jamiehook01,What you will need to do to debug this is enable Verbose logging on your server for the Forms Services categories, reproduce the error and then check the ULS logs on the server - these should provide you direction on why it fails.ScottAnonymous
November 24, 2008
Hello Scott.IRT this post "Monday, October 08, 2007 9:42 AM".I have followed the tutorial on how to add to a sharepoint list and it works beautifully. Naturally, that was not enough and I needed to update and delete. After further reading, I found your later entry addressing this and I have hit some snags. I copied your code into my form, but I am getting some build errors. It is probably just some syntax, but I am not a programmer and I am struggling. I get these two errors:The name 'e' does not exist in this context.The type or namespace name 'serverName' could not be found (are you missing a using directive or an assembly reference?)Here is my code:public void InternalStartup() { ((ButtonEvent)EventManager.ControlEvents["UpdateList"]).Clicked += new ClickedEventHandler(UpdateList_Clicked("Update", e.Source.CreateNavigator())); } public void UpdateList_Clicked(string strOperation, XPathNavigator e) { { //Create a new instance of our "Lists" web service serverName.Lists myList = new serverName.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["MyContacts"]; //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create XPathNavigator objects for each field from our list XPathNavigator xnID = e.SelectSingleNode("@ID", ns); XPathNavigator xnFirstName = e.SelectSingleNode("@FirstName", ns); XPathNavigator xnLastName = e.SelectSingleNode("@LastName", ns); XPathNavigator xnTitle = e.SelectSingleNode("@Title", ns); XPathNavigator xnEmail = e.SelectSingleNode("@Email", ns); XPathNavigator xnPhone = e.SelectSingleNode("@Phone", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); //Create the CAML query passing in the value of each of our fields from the form if (strOperation == "Delete") { updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Delete'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "</Method>"); } else { //Create the CAML query passing in the value of each of our fields from the form updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Update'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "<Field Name='FirstName'>" + xnFirstName.Value + "</Field>" + "<Field Name='LastName'>" + xnLastName.Value + "</Field>" + "<Field Name='Title'>" + xnTitle.Value + "</Field>" + "<Field Name='Phone'>" + xnPhone.Value + "</Field>" + "<Field Name='Email'>" + xnEmail.Value + "</Field>" + "</Method>"); } //Update the list XPathNavigator xnListGUID = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ListName", ns); XmlNode node = myList.UpdateListItems(xnListGUID.Value, updates); //Requery the data source to reflect the updates dsContacts.QueryConnection.Execute(); }Sorry for resurrecting something kinda old, but it would greatly improve my quality of life! Thanks in advance for your assistance.Don F.Anonymous
November 24, 2008
Hi Don F,The "serverName" issue is most likely caused by either not having added a "web reference" to the "Lists.asmx" web service or you added it and you need to change "serverName" to whatever name you entered for ther web reference.In regard to the "e" error, it looks like you have one too many opening braces ("{") after "private void".Now, also - the way I wrote this code (if you want to follow it exactly) would be as follows:Assuming you have a button with the ID of: UpdateList, then the only line of code you should have in its "clicked" event is this:UpdateList("Update", e.Source.CreateNavigator());Then you need the "UpdateList" procedure as follows:public void UpdateList(string strOperation, XPathNavigator e) { //Create a new instance of our "Lists" web service sheimserver.Lists myList = new sheimserver.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["MyContacts"]; //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create XPathNavigator objects for each field from our list XPathNavigator xnID = e.SelectSingleNode("@ID", ns); XPathNavigator xnFirstName = e.SelectSingleNode("@FirstName", ns); XPathNavigator xnLastName = e.SelectSingleNode("@LastName", ns); XPathNavigator xnTitle = e.SelectSingleNode("@Title", ns); XPathNavigator xnEmail = e.SelectSingleNode("@Email", ns); XPathNavigator xnPhone = e.SelectSingleNode("@Phone", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); //Create the CAML query passing in the value of each of our fields from the form if (strOperation == "Delete") { updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Delete'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "</Method>"); } else { //Create the CAML query passing in the value of each of our fields from the form updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Update'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "<Field Name='FirstName'>" + xnFirstName.Value + "</Field>" + "<Field Name='LastName'>" + xnLastName.Value + "</Field>" + "<Field Name='Title'>" + xnTitle.Value + "</Field>" + "<Field Name='Phone'>" + xnPhone.Value + "</Field>" + "<Field Name='Email'>" + xnEmail.Value + "</Field>" + "</Method>"); } //Update the list XPathNavigator xnListGUID = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ListName", ns); XmlNode node = myList.UpdateListItems(xnListGUID.Value, updates); //Requery the data source to reflect the updates dsContacts.QueryConnection.Execute(); }ScottAnonymous
December 02, 2008
Hi,I've read this page and I'm not sure if it can help me to do what i have to do.I explaine : I have a SPS2003 form library that I have to migrate to a WSS 3.0 list.The forms have attachment inside them.The goal is to populate columns of the list with the datas that are in the form and have the form attachement attached to the list......Is it possible ?Regards.Anonymous
December 03, 2008
Hi,There are a couple of "hurdles" you are going to need to address for this to work:#1: Attachments in an InfoPath form are base64 encoded - to extract them you need to use custom code (unless you want to manually open each form and save out the file.) Here is a Knowledge Base article to get you started:892730: How to encode and decode a file attachment programmatically by using Visual C# in InfoPath 2003 Service Pack 1http://support.microsoft.com/default.aspx?scid=kb;EN-US;892730** NOTE: The code in this article was specific to InfoPath 2003. If you are using the new 2007 object model with VSTA, you will need to convert this code.#2: Once you extract the file now you need to get it to the appropriate item in your list. The SharePoint "Lists" web service has an "AddAttachment" web method that will allow you to attach a file to a list item so this may be of help.However, if you run into any issues using the web service a SharePoint group will be a better option for assistance.ScottAnonymous
December 08, 2008
Hi,This is almost exactly what I needed. I implemented your solution to make sure it was working and it does add new items to my list. That's not quite what I need to do.I've ready all the posts on updating an existing list item, but I think my needs are somewhat simpler and am hoping you can simplify for me? I use a lot of C# code-behind so that part won't be a problem.I feed-in an SP List of 'variables' which allows me to dynamically control behavior within the code.My form submissions are done programmatically based on "OnClick" events.Just before submitting the form, I'd like to update just one of my variables which is stored in the 'variables' SP List. I'd like to do it completely behind the scenes. It's just a counter for certain actions taken by the user. So I'm wondering how much of your original solution can be eliminated if I merely need to update one existing item with each submit?I could go ahead with your suggested "update" code, but I see it involves having buttons for each list item. My list item is always the same thing (and invisible to the user) with just a varying value being sent to it automatically.Thanks for any help you can provide!--EricAnonymous
December 08, 2008
Hi Eric,I would say just to use the basic code I have here in these comments for doing the "update." The only reason I used a button in the repeating table is so that you could determine which list item you were updating. If you are updating the same one all the time then you can just hard-code the list item ID.ScottAnonymous
December 09, 2008
Hi Scott,Thanks for your reply! I setup a new solution and am trying the basic update process you've listed above.I think I'm in trouble. So far all my coding in the InfoPath code-behind has been done with VS2003 (and until recently against SP2003 sites). Now our sites are SP2007, but we're still using VS2003 which has been working OK.In order to use the XPATHNAVIGATOR, do I need to upgrade to VS2005 (.net 2.0)? I don't seem to find a reference to it from within VS2003 but maybe I'm missing something?Also, we have a thousand or so documents in the site I'm working with. Will it require updates to all the existing documents if we move to VS2005?Any other concerns with upgrading to use VS2005 at this point?Thanks and sorry for my ignorance on this. I know there's obvious advantages for upgrading - it's just we run very lean so tend to wait until necessary. I noticed we could start passing variables into InfoPath via the URL string if we were on VS2005 too. That would be helpful.--EricAnonymous
December 09, 2008
I have a question. I have an Infopath 2007 form for submitting expenses. The completed form is submitted to a SharePoint Library. No problem there. Depending on the type of expense, specific individuals have to approve the expense.I want to create a workflow, based on the type of expense, to feed to the specific individuals for their approval. How can I address this in the Infopath form, and how can the submission kick off the workflow?PCAnonymous
December 09, 2008
@InfopathHi,if I put aside the attachment problem....does this work with existing forms ?I mean even if I change the template.xsn using this method, will the forms already created be modified ? How to pupolate the list using the form : do I have to open the one by one to submit them to the list ?Sorry if my questions seems dumb but it is quit non obvious to me :(RegardsAnonymous
December 10, 2008
EricL:Yes - the "XPathNavigator" object is new so you will need to either migrate and use Visual Studio Tools for Applications (behind InfoPath) or Visual Studio 2005 or convert the code in this post to the older object model.In regard to "thousands of documents? - are you referring to XSN or XML files? If the thousands of documents are completed XML files and are all bound to the same XSN, then once you make the code change in the XSN the existing XML files will be updated automatically (assuming you have not changed the default behavior) once they are opened.Pcorrell:There is no true "workflow" capabilities in InfoPath. You can attach a workflow to an InfoPath form or you would typically use InfoPath forms in your workflow (i.e. the Init form, Association form, etc.) However, workflows are created in either SharePoint Designer or Visual Studio and support for these are handled through the SharePoint team. So I am not trying to "push you away" but I do very little with workflows here in the InfoPath group and would suggest you post that question to a SharePoint/Workflow group.Arghhhh:Ok - let's forget the attachment part of the question for a moment. You have an existing "library" that contains completed InfoPath XML files - correct? And now what you want/need to do is take the "data" that is in each of those files and migrate/move/copy to a new SharePoint "list" - correct?So assuming my understanding is correct there is nothing built-in to InfoPath that would facilitate this. First off - you can not "submit" InfoPath forms/data directly to a SharePoint list...hence the reason for this post. So you will need to either:Implement this solution in the XSN that was used for all the completed InfoPath XML forms and open each one and submit the form to the listSee if there is some type of SharePoint code solution that you could implement to enumerate each of your completed forms, pull out the relavant data and create list items of that data. I would think there is a way you could do this using the SharePoint object model but this is not my area of expertise. I would suggest you pose this scenario to one of the SharePoint groups. ScottAnonymous
December 23, 2008
Hi Scottsorry for my english ... but i'm learning :0)well the example is running now but i need to made this with a choise option, it's is possible? or with data type date? because i'm try and i can get it...thanks a lot for any orientation ...Best Regard.JavierAnonymous
January 05, 2009
The comment has been removedAnonymous
January 05, 2009
Hi Scottthis work perfect !!! :0)thanks a lot!! for test was fine... Well now i've problem when made my real development because i'm trying to do a form with 12 question (choises ) and 12 observation ... and can´t get it ..!! they don't show any error but my sharepoint list will don't updated!!!is possible to catch an error in the comunication between my application and sharepoint ???May at this point <Batch OnError="Continue"> --> I don't want to continue, i need to know the error !! is this possible???Thanks a lot for your help...JavierAnonymous
January 05, 2009
ScottI think the big problem is the name in the field of the list (in sharepoint) because i try with two kind of names :P.e :P1 --> don't work and don't show any error, but my list is not updated...a --> Work! :s is very odd but if i change just the name's all work perfect ...mayby by the way is working webservice ???Best RegardJavier.Anonymous
January 06, 2009
Hi Javier,I am certainly glad to hear you were able to get it working; however, I agree - it seems odd that a field name of "P1" does not work. I am assuming that your XML file has the field specified as "P1" and not "p1" - correct? Also - one thing you may want to do is put the field back in SharePoint as P1, recreate the connection from within InfoPath, save out the files from the XSN (File -> Save As Source Files), open manifest.xsf with Notepad, find that SharePoint connection and make sure that field is indeed coming through as "P1". I have seen one case where a customer specified a field name for their column and for some reason the actual name in SharePoint was something different.ScottAnonymous
January 06, 2009
Hi ScottI am assuming that your XML file has the field specified as "P1" and not "p1" - correct? --> Yes ! i know that XML is Case Sensitive... so i'm using the same name for both!!...I have seen one case where a customer specified a field name for their column and for some reason the actual name in SharePoint was something different. --> Finally i'm delete both files (List and Form) and try again and OPS! don't show any error but still don't update my list... so i went to the path of the manifest and effectively the name in the sharepoint list is diferent ....Why this happen ? i think is a bug of sharepoint...So now i'm trying again deleting both files... but is some tired to do .. because for made a simple form spend so much time.. because if I make a mistake i've to do everything again :0(Maybe this kind of feature is better not be implemented between sharepoint and Infopath ...Well i will comment my hard way to get this ....Thank's a lot again ...JavierPs : I'm thinking in traslate this article to spanish and Portuges, when will be done i tell you...Best Regard...Anonymous
January 06, 2009
Hi Javier,I am not a SharePoint expert so I am not sure why the actual name is sometimes different. You may want to post that question to a SharePoint blog and see if you get any insight. However, in the future, once you create your SharePoint list you simply need to insure the XML file contains the same names exactly as they appear in the manifest so a "quick" step is just extract the files from the XSN, open the manifest and verify the names. Then simply make sure your XML file matches what is in the manifest.ScottAnonymous
January 06, 2009
scotthi look :<xsf:field sharepointName="b" infopathName="b"></xsf:field>
i don't know why the name of this field "x0063" if in the list is declared like "c" ...Best Regard...Javier.<xsf:field sharepointName="bo" infopathName="bo"></xsf:field> <xsf:field sharepointName="x0063" infopathName="c"></xsf:field>
Anonymous
January 06, 2009
Oki doki scott i will post to a sharepoint blogger this issue ... thank again for your usefull help...JavierAnonymous
January 06, 2009
The comment has been removedAnonymous
January 06, 2009
Hi Javier,After you change a field name in your SharePoint list are you updating the connection in InfoPath? If not, this would be the expected behavior. If you make a modification to the list schema (i.e. add/delete a field, change a name, etc.) you then need to complete these steps in InfoPath:From the Tools menu choose Data ConnectionsSelect your list data connection and click Modify Complete the wizard all the way through and now any change you made should be reflected in InfoPath ScottAnonymous
January 06, 2009
Hi Scotti not make the update just delete the conection to the list and then created a new conection follow the wizard , but still this doesn't work...At this moment i'm fix this just looking with so much patience all the name's and is working now!! :0)But for get this all the time was create my list on charepoint - create the conection - see the manifest - when the name's on both sides , when the name were the same - all run perfect... in fact now is working without problem...for me the problem is with sharepoint or maybe if InfoPath keep a copy on cache ... for example on this case :<xsf:field sharepointName="x0063" infopathName="c"></xsf:field>On my local XML the name were "c" .in the list also "c" but how you see on manifest has "x0063" , i try deleting the list (don't work, the behavior was the same).finally created other list and then work... i know is odd but is the only way that get this run ...Best Regard.Javier.Anonymous
January 07, 2009
Hi Scott,First of all, I've read through all the postings in this blog and you really know your stuff! I've created a form that submits directly to a SharePoint list, which is great-- solves a problem I've been working on for weeks!Now I'm trying to modify my form so that it auto-populates the fields from another view within the same form... basically, I've got one view in which users input a bunch of data (which will submit to SharePoint using the regular method), but I've created a second view with your solution, and would like to update columns in a separate SharePoint list based on input the users entered in the first one-- without making them have to switch views or input data a second time.I thought that after creating the second view with the repeating tables, as per your instructions above, that I could set the default value to equal data from other fields in my first view-- obviously, it doesn't seem possible to do this. Any idea how to set a default value for the fields your tutorial has helped me create? My Add List Item Template looks like the following:<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name='Title'></Field> <Field Name="Group"></Field> <Field Name="MTSTeam"></Field> <Field Name="ProjectManager"></Field> <Field Name="PercentOfOverallWork"></Field>
</Method></Batch>But I'd really love to be able to autopopulate those fields with data already entered into the form (OR, figure out how to get the other fields in the first view to populate columns in my SharePoint list without the need for a repeating table, etc.).Any ideas? Is this possible? Or am I out of luck?Thanks again-- this post has been fabulous!Brynnie5209<Field Name="PriorityOfWork"></Field>
Anonymous
January 08, 2009
hi Brynnie5209i'm made some like you but not with autocompletedata, i'm make an WorkFlow that after send the form to the list the list display the data input and data from another list (with a workflow in Sharepoint Designer that can update a List when new item is added).... now if you want to get data from a list this perhaps can help you http://cs.vbcity.com/blogs/skullcrusher/archive/2008/12/16/get-list-of-site-users-in-infopath-form.aspx</a">1...I hope this help you ....Best RegardJavier.Anonymous
January 08, 2009
Hi ScottMe again i need some more orientation .. i'm trying to publish my form and i need enable the feature "Open in Browser" but i can't get it because in all forum's say that i've to remove my C# code....This for me don't make sense ... do you know if exist a way to publish with C# code and enable the compatibility to open in a Browser ???Is this possible??? or just am forced to take the client installed InfoPath???Thanks a lot for any orientation... i will try ...Bye Best Regard ..JavierAnonymous
January 09, 2009
Brynnie5209:Using the method described in this blog post, you cannot auto-populate those fields. There is another way to do this (without code) but it is an "InfoPath Client Only" option (in other words, it will not work in browser forms) and would require somewhat of a re-design of your XSN. If you would like to pursue this, let me know and I will provide you with the steps.Javier: Yes - you can publish an XSN with code for browser use - you just have different steps to follow...take a look at this information:http://msdn.microsoft.com/en-us/library/bb267337.aspxAlso - in the future, please keep all comments and questions specific to the blog topic.Thanks!Anonymous
January 09, 2009
Scott,That would be amazing, if you were willing to provide the steps-- I tried to re-work one of the code solutions you provided for auropravin (who wanted to add a date picker, rich text field, etc.) by entering blank text fields, setting the default, and then tweaking the code you provided to him-- made a total muck of it, of course, as I'm more of a "no code solution" kind of girl. Please let me know if there is other information I would need to provide for you; the infopath form I'm using isn't browser-enabled (I was willing to decrease functionality and make it browser form to use your original solution, so I'm thrilled if there's a way to solve for what I'm trying to do without changing a lot of the rest of my form; even MORE thrilled if I don't have to use code).Javier, thanks for the suggestion-- the link you posted was helpful for another project I'm working on! And thanks again Scott for your quick response and willingness to teach me something! v/r,Brynnie5209Anonymous
January 09, 2009
The comment has been removedAnonymous
January 09, 2009
Hi Scott,Thanks for this great tutorial! It worked a treat for me. My problem is styling.Im currently doing a company project for user requests, and hopefully my form will get passed around all the managers in the company. Now if i gave them the above, i dont think they would be very happy with just a list of forms which didnt really mean much to them.What I'm after at the moment is a InfoPath form which just submits to the list (wont be displaying any information from the list in the form) which is basically what you have above. But i would like to design my own form, and not have the form output from the list.Is there any way to do this?CheersJamzAnonymous
January 09, 2009
Hi Jamz,I am not sure I completely follow what you are asking; however, the only reason I include the list items in this sample is just so you can see it was added. There is no need to have the existing items display on the XSN. In regard to form design, using this blog limits what you can do; however, take a look at my prior response to Brynnie5209 - this is a different way to design the XSN so you have more control over formatting; however, this will not work in the browser unless use code, which means you really don't need anything from this blog post. :)ScottAnonymous
January 11, 2009
Hi ScottIs just for thank you for the help i'm finish my prototipe and everythinks is running Ok !So see you the next time....Best Regard.Javier.Anonymous
January 11, 2009
Hi Javier,I am glad to hear everything is working for you!Take care,ScottAnonymous
January 19, 2009
Scott,Just had to write back to THANK YOU for the wonderful help-- your solution worked like a charm, and I'm now able to do so much more with the data my team submits. This solves a problem we've been trying to work out for months, and I can't tell you how refreshing it's been to have someone help you solve a problem while simultaneously teaching you something along the way. Thank you again; I really appreciate it, and look forward to reading more of your posts in the future!v/r,Brynnie5209Anonymous
January 19, 2009
Hi Brynnie5209,That is great to hear - thank you! :)ScottAnonymous
January 19, 2009
Hi Scott:I'm here again so i've another problem :0( , once i test my aplication on my computer connect to the server all is ok ... but i've a Virtual machine like server and there i've one user by default and when this user try to send the form , appears this message:at Microsoft.Office.InfoPath.MsxmlNavigator.IsValidNode(MsxmlNode test) at Microsoft.Office.InfoPath.MsxmlNavigator.MoveToFirstChild() at MS.Internal.Xml.XPath.XPathChildIterator.MoveNext() at MS.Internal.Xml.XPath.ChildrenQuery.Advance() at MS.Internal.Xml.XPath.ChildrenQuery.Advance() at MS.Internal.Xml.XPath.ChildrenQuery.Advance() at MS.Internal.Xml.XPath.XPathSelectionIterator.MoveNext() at System.Xml.XPath.XPathNavigator.SelectSingleNode(XPathExpression expression) at System.Xml.XPath.XPathNavigator.SelectSingleNode(String xpath, IXmlNamespaceResolver resolver) at SataFinal.FormCode.Btn_Submit_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)But if send from my pc all run right ... you know can happens??? why this behavior??? may be i've to do some more configuration ????Thanks a lot for any orientation...Javier.Anonymous
January 19, 2009
Hi Javier,There is probably more to this error message but it appears it is failing when submitting the data. You may want to check the following items:Does that user have permission to add items to the list?Is the XSN set to Full Trust? If so - did you sign it with a certificate? You could also run the Fiddler (or Netmon) tool to trace what is occurring to see if this helps isolate the problem. If you need more assitance troubleshooting this, you may want to open a support case to dig into this further.ScottAnonymous
January 30, 2009
Hi, Scott - the meeting minutes form is working beautifully for us, but of course now the CIO wants to spiff it up by automatically retrieving agenda items that are posted to another list in the same site. I configured the data connection to retrieve the fields that we need; however, there is a Notes column (Multiple lines of text) in the list that does not appear in the list of available items to select when creating the data connection. The other columns are "selectable" and appear just fine in the form.Is there any restriction on this type of column? Thanks for any suggestions.JanAnonymous
January 30, 2009
Hi jhillppc,Correct - some data types are not available via the list connection like this; however, you should be able to get all the columns using the method described in this blog post:Populating form data from SharePoint List Viewshttp://blogs.msdn.com/infopath/archive/2007/01/15/populating-form-data-from-sharepoint-list-views.aspxScottAnonymous
February 20, 2009
The comment has been removedAnonymous
February 23, 2009
Hi Jan,You should not need to add a new connection; however, to "update" an existing list item you will need to be sure you have that items "ID" value. So be sure this field is in your data connection. Then you should be able to add those two new fields to the data connection and implement the same basic code.Have you tried this approach yet?ScottAnonymous
February 23, 2009
Hi, Scott - added "ID" to the addserver.xml; and to the secondary data connection, so now ID, Project and Requestor appear in the secondary data connection. The two additional lines have been added to the code. Form published and uploaded on the Sharepoint applications, Manage Form Templates site. A new form loads and can be properly submitted. BUT, when trying to update the form, then submit to the list, I get "An entry has been added to the Windows event log...Log ID: 5337." Haven't found much on this error, but that's where I'm at, down here in the deep end again.Thanks for the info.JanAnonymous
February 23, 2009
Hi Jan,What you will probably need to do at this point is step through your code to make sure everything is working as you expect, variables are set to the correct values, etc.If you need more assistance with this it may be better to open a support case so someone can work with you 1:1 to help debug the problem.ScottAnonymous
March 23, 2009
hi Scott,Thanks for the article.I followed the steps described in this article. When I click submit I get the message saying "This form was submitted succesfully". But there is no new item in my contacts list.I foundSoap error: Unspecified HTTP error..Event Xml:<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="MSSOAP" /> <EventID Qualifiers="49152">16</EventID> <Level>2</Level> <Task>4</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2009-03-23T13:20:30.000Z" /> <EventRecordID>868</EventRecordID> <Channel>Application</Channel> <Computer>BDMWS-02.sunplusdata.com</Computer> <Security /> </System> <EventData> <Data>Unspecified HTTP error.</Data> </EventData></Event>please specify the solution for this error :Anonymous
March 24, 2009
The comment has been removedAnonymous
March 27, 2009
Awesome! I had a lot of problems getting this to work and it turns out the column names were not what I was thinking they were. One way to check your column names as they appear in web services is to click on column name in the list and then look at the last field, for example:http://somesite/_layouts/FldEdit.aspx?List={58E78B34-EE26-4E5F-BC7D-A4F8189775F8}&Field=E_x002d_mail_x0020_AddressIn this case my column name was E-mail Address which resulted in E_x002d_mail_x0020_AddressI haven't read all the comments yet. What about Data validation, how can that be done (the easier the better)? Let's say I want to have e-mail field and confirm email fields and check if they are both equal (using Infopath rules to do so would be preferred) And also what about better formatting for the fields and making the form look good?In any case, this is great. I used this to get aroung anonymous submission problem (since anonymous users can add items to the list, but not libraries)Anonymous
March 30, 2009
Hi bawcior,I am glad to hear you were able to get the process to work! :)In regard to your other questions, we need to keep the blog posts specific to their topic so I am not going to go into a lot of detail.Validate e-mails: You will want to look at using Data Validation on each e-mail field and possibly look at using the "translate" function. If you don't incorporate the "translate" function these e-mails, for example, will not match:abc@hotmail.comabc@hotmaiL.comFormatting: That question is obviously very broad and could be quite subjective. :) I would encourage you to poke around the Microsoft site (after searching for InfoPath) and you should find some good pointers.ScottAnonymous
April 07, 2009
Hello Scott!Thank you so much for the solution.I have a related question for you, however. In the revolving table from the Batch data source, how can I make the entries multiple choice?I know I can change the cell to a Drop Down list, but how do I get the drop down values to be individualized for each cell on the Preview side?I thought I could instead build other cells in the forms data source and make those multiple choice and have the information in the Batch revolving table feed from those cells, but I still do not know how to separate each individual entry. Does my question makes sense?Thanks!ElenaAnonymous
April 07, 2009
Hi Elena,This is how I am interpreting your question: when you follow the steps documented in this post, all of the fields to be completed show as basic text boxes. What you would like to do is have one or more of those be dropdown boxes - is this correct?If so, then the way to do this is documented in my response to a user on 1/9/2009 in this post. However, it is important to know that this option will only work for forms you will be using in the InfoPath client. If your XSN is designed for both the client and the browser, then you would still need to make the basic design as I documented on 1/9/2009 but you would need to use managed code to populate the XML file used for the list update. (In other comments in this blog, I have provided code to perform the updates.)ScottAnonymous
April 07, 2009
I want to set some of the fields that are being submitted to SharePoint to some value (not user typed). How do I do this either in InfoPath or C#? ThanksPawelAnonymous
April 08, 2009
Hi Pawel,Take a look at my response on November 18, 2008 - there is sample code there and part of that is setting values in the XML file.ScottAnonymous
April 23, 2009
My goal is to have an InfoPath form submit fully to SP list... not just set up column data.If it is submitting to a SP list... where does it get initiated from? Could we use a document library to initiate the form and have it submit to a list and not to the library at all (effectivelly just using the document library to pull up the template)?I plan on using qRules to submit attachments to a SP list to reduce the load time of my InfoPath form. It would be my dream if I could call up an InfoPath form and then submit the form and attachments (seperately) to a single item on a list.v/r,Jason BoreanAnonymous
April 24, 2009
The comment has been removedAnonymous
May 13, 2009
The comment has been removedAnonymous
May 15, 2009
Hi Ami,I am not sure I follow what you are asking in question #1. Are you asking how you could submit your data to a list without using the CAML XML template? If so, then the only way to do this would be to use custom code - in the code you would basically be creating the CAML expression to send the data to the list. If this is what you are asking, take a look back through the comments on this blog as I have provided sample C# code on how to to this basic process.In regard to question #2 about adding an attachment - you would need to use custom code to extract the contents of the attachment (see http://support.microsoft.com/default.aspx?scid=kb;EN-US;892730) and then make a call to the AttAttachment method of the "lists" web service to upload the extracted file contents to the list (http://msdn.microsoft.com/en-us/library/lists.lists.addattachment.aspx).ScottAnonymous
May 17, 2009
How to retrieve data from SharePoint List using InfoPath 2003Hi Scott, I have been troubled in this question for a long time. My request is this:Say there is a SharePoint website on my domain, and I have admin rights to the website but have no write access to the SharePoint Server. I want to design a infopath 2003 form, with 2 or 3 textboxes, one search button and one repeating table. When I type in the textboxes the search words, and then clicking button, the repeating table will display the values retrieved from SharePoint List.Please do me a favor to give me a detailed guide! Thank you very much!!PS: I have the environment to write managed code(VS2003 and Infopath SDK) , but there is a small problem: I can not using Microsoft.SharePoint.dll, what's the reason for this? Is this because I don't have Windows SharePoint Service 3.0 installed on my OS windows XP professional?Thanks again!!Anonymous
May 18, 2009
The comment has been removedAnonymous
May 19, 2009
Great Great Thanks!Hi Scott,I can say nothing but thanks for your great great help! I followed your guidance and it really works! Althrough I am in distant China, I was touched by your kindness.But I a little greedy that I have two other relevant questions, please help:1, How can I make foggy search (or say as T-SQL "like" function, in your example -- Alias: sheim, WorkedFor: jasperh, when you input "she" in the form, the result "Alias: sheim, WorkedFor: jasperh" can also be displayed). How can I make this feature?2, How can I update the value of result? Let me take "Alias: sheim, WorkedFor: jasperh" for example, if I change sheim to zhangweisjz, and click a button, the valued is submitted by the SharePoint List. (I don't mind the way of writing code to solve this problem)3, When creating a form in SharePoint form library, user will have to save the form and type in a certain name. Could we have a function that form can generate a random string as its name when saving?Thank you very much!PS: I made a small modification of your codes, so that we can search more than once:string tempURL=dList.FileURL;if(nodeAlias.text!=string.Empty){dList.FileURL+="&FilterField"+i+"=Alias&FilterValue"+i+"="+nodeAlias.text;i+=1;}......dList.Query();dList.FileURL=tempURL;I dare not show my poor programming skills to a master, but to make it simple to use if someone also needs to make this kind of function.Anonymous
May 19, 2009
Hi zhangweisjz,I am glad you were able to get the sample working!In regard to your other questions:#1: I am not a SharePoint expert but I don't know if there is a way to implement "fuzzy" searching as I don't believe SharePoint suppports (by default) wildcard searching. This may be better posed to a SharePoint blog.#2: You can use the methods described here throughout the comments to update the list. You can either use the XML Resource file method or simply build the CAML query in code and perform the update. Now - you can place a button control in a new column in your repeating table and this will allow you to update just the values in that row or you could use a button outside of your repeating table and use code to loop through all the rows and update the values.#3: Instead of using the built-in Save, create a "Submit" data connection. This way you can use formulas and/or fields from your form to create the file name.ScottAnonymous
June 01, 2009
Scott,Once again I want to thank you for the help you gave me back in January to enable my InfoPath form to auto-populate fields (and therefore users to input data from different types of fields [date boxes, drop-downs, etc.]) before submitting to a SharePoint list. The solution you helped me with has been so popular, in fact, that I’ve been asked to use the method again to create a different type of form for my group, which leads me to another opportunity to pick your brain, posted below:I’ve been asked to create an InfoPath / SharePoint solution which will enable users in our group to submit “tokens” to other employees in our organization as a thank-you/atta-boy. Each FTE starts the year with 100 tokens to give out to others, and at the end of one year awards are given out to employees who have achieved certain levels of received tokens. My InfoPath form enables users to nominate someone for a token, and the data is then (successfully, thanks to you) submitted to a SharePoint list which tracks all of the nominations. The other part of your solution is applied when a user opens up a new form—the InfoPath form pulls the SharePoint list data into the table that’s created in my form (step 5 from your original instructions), and I’ve used sum and counting functions within this table to track how many tokens the user has submitted, received, and (with a little bit of math) has remaining to give out. This works like a charm in my testing environment (i.e. submitting to a blank SP library with new data), but I’m creating this solution as a 2nd version to an old method, which means I will be working off a SP list that has 7000 rows once I migrate all the archived token data into my created SP list. This is (obviously) causing me a number of problems, including:Item limits in the SharePoint list—I’ve configured the list view to show all items, which works fine in SP but still doesn’t manage to pull all of my rows to my InfoPath form to enable the token-counter function I’ve created.Even if I cleaned up the archive so that the list started with less rows to track and did some manual work to keep the SP library from getting too big, I’m noticing that anything over 500 rows in my SP list causes my InfoPath form to open VERY slowly. My question, after all that build-up, is this:I know you mention in your original posting that you can configure the InfoPath form to NOT pull list data back into your form, but I need that data in order to perform the token-counting functions I’ve set up. Is there any way to pull the SP List data in such a way that, rather than individual rows, the data I pulled from the SP list I’m sending to could either be consolidated in some way so that my form doesn’t get too unwieldy, OR is there a way to configure my form to only pull data from specific COLUMNS in the list? I’m hoping that one of these options may enable the functionality I’m trying to achieve without causing the form to hang while opening and still enable the token-countdown function I need to complete my solution.I’m hoping this is still considered on-topic for your blog posting; I know I’m touching on a couple of other areas (SP Item Limits, etc.), but I’ve tried a number of other ways to achieve the same outcome with no success. Any thoughts on whether or not I can enable token-counting using the method you’ve outlined in this blog would be greatly appreciated. Thanks again! Sincerely,Brynnie5209Anonymous
June 02, 2009
Hi Brynnie5209,I am glad to hear things are working well!In regard to your new questions:1) Showing all items in InfoPath: - Navigate to your list - Select the "Modify this view" option from the View dropdown (make sure you are showing the default view) - Expand the Item Limit option - Select the option "Limit the total number of items..." and then set the number to something larger than you think you will need (i.e. 10000)2) Amount of data returned - If you complete the above steps, your form will get even slower <G> - As you have seen returning large amounts of data to an InfoPath form will cause it to slow down drastically. I am not going to go into here all the reasons why but you will really need to limit the amount of data you return. So - some things you can look at trying:When you created your data connection to the SharePoint list, you can select which columns you need to see - make sure just the ones you absolutely need are checkedIf there is a column where you could provide a "filter" (i.e. only return data for 2009 as an example) then you could use the method described in the following blog post to create a different type of connection where you can provide a filter "field" and a filter "value": http://blogs.msdn.com/infopath/archive/2007/01/15/populating-form-data-from-sharepoint-list-views.aspxIf these options do not help then maybe a better option would be to store this data in a database (i.e. Access or SQL Server) where you could create a query (view) in the database that would return just a "summary" of the tokens, something like this:Scott Heim, 50 tokens remaining** This assumes that you don't have 7000 rows corresponding to 7000 employees. :)I hope some of this helps!ScottAnonymous
June 04, 2009
Hi, Scott - hope you're doing well. Thanks again for your expertise in solving our problems with Infopath and our Meeting Minutes a few months ago. I've been tasked with setting up another list for submitting help desk requests, and created the list from the Help Desk application template. Of course some modification of the list was required by adding a few columns, and the editform.aspx and dispform.aspx had to be modified to accomodate the new columns. The "Comments" field was left as is--columnwise and on the forms--and data can be entered the first time a list item is edited. If someone needs to go back to the item to add more comments, any previous entry appears in the dispform.aspx, but disappear when the editform.aspx opens. All other fields remain populated. I've verified that "@comments" is referenced in the table on both forms, and can view the data using "show data values." Just another one of those SP gotchas? Any thoughts other than trying to recreate the Comments field? Thanks much.JanAnonymous
June 04, 2009
Hi Jan,Glad to hear all is going well! :)The editform.aspx and dispform.aspx are the built in SharePoint forms used to view and update list items - correct? If so, I don't have enough SharePoint expertise to understand why this occurs. If you can tell me where you downloaded the Help Desk template, I can try it on my side to at least see if I get the same behavior.ScottAnonymous
June 04, 2009
Scott - I found it at http://www.microsoft.com/downloads/details.aspx?FamilyId=CE90D6D7-7B96-47BF-A22F-A7E8C5D40647&displaylang=enPlease don't spin your wheels too much on this...I can try deleting the column and re-adding as a last resort. Thanks for your quick response!JanAnonymous
June 04, 2009
Hey Jan,Thanks - as this appears to be solely a SharePoint application, I'll let you see what you can find. If deleting and recreating the Comments column does not help, it will probably be worthwhile to touch base with one of the SharePoint blogs. Hopefully they can shed some light on it for you.Now, if this is something that only appears when using InfoPath, then let me know. :)Take care,ScottAnonymous
June 07, 2009
Hi Scott,Sorry to bother you again. These days I am working on InfoPath it is fun but I also got a lot of questions.Question1:I have a request that can InfoPath avoid user to save a form which has a same value as another one?For example,A booking car infopath tool,If one user has finished his applicaton:car number: 'ABCD', time: 2009/6/8 8:00:00 to 2009/6/8 12:00:00,Another user can not save a template if he filled his application form with the same content:car number: 'ABCD', time: 2009/6/8 8:00:00 to 2009/6/8 12:00:00.Is this possible?Question2:And going further, is it possible to avoid:If the time frame 8:00:00 to 12:00:00 is booked, the application form with the time frame 8:00:00 to 18:00:00 can also be prevented.The last question:When we save a form, we will have to manually input the form's name, is it possible that the system will generate a number (random or other kinds) as the form name?Thank you very much.SaiAnonymous
June 07, 2009
Our user has another concern about the required *field with empty content still can be sent out to forward to next step.Is it possible to solve this?Thank you.Anonymous
June 08, 2009
The comment has been removedAnonymous
June 08, 2009
Hi Scott,Thank you for your reply.I would like to Share my design to you. Could you please send me a email so that I can get your address?Mine is zhangweisjz#gmail.com, please replace # with @.Many thanks.SaiAnonymous
June 08, 2009
Hi Sai,Unfortunately I really don't have the ability to do this as I am in support and need to spend the majority of my day assisting customers that have opened support cases.I provide answers and samples on this blog as I have time but to review a design and suggest solutions or changes to that design is something I don't have the time to do.I hope you understand.ScottAnonymous
June 19, 2009
Hello , Scott !!Thanks for this helpful article regarding submition to sharepoint list .i tried this article to submit to list and cheked 4-5 times , but i m not getting data in list after i entre data through infopath form , i get the msessage that tell me that " The FOrm was submitted succefully " but its not inserting data into list , as my form display the data from list , but there is only problem in inserting the infopath form data into list...i stuck with this problem since many days could you help me please as soon as possible please !!Thanks & Regards ,Dipti ChhatrapatiAnonymous
June 22, 2009
Hi Dipti,I know there are a lot of comments to this post but please read through all of these as there were a number of questions about this same behavior and there are numerous reasons why this behavior occurs and I have documented those throughout the comments.Thanks,ScottAnonymous
June 22, 2009
Hello…Thank you very much for your kind reply!!But I have followed following steps after reading comments in this blog1) Proper GUID for list identification.2) I did connection properly for submit and receive type.3) I get list web services for appropriate site too.4) I checked event log to check errors , but didn’t get any.5) Xml file also contain appropriate fields as columns in list.is there any testing missing ??? Please tell me so I can get result ASAP.Thank You,Dipti ChhatrapatiAnonymous
June 23, 2009
Hi Dipti,Here is what I would suggest you review next:Create a new folder on your machine called: SourceFilesOpen your XSN in Design View From the File menu choose Save As Source Files and select the SourceFiles folder you created Close InfoPath completely Open the SourceFiles folder, right-click on manifest.xsf, choose Open With and select Notepad Scroll down in the manifest until you find a node that starts as follows: <xsf:sharepointListAdapter Within in this node are all the column names from your SharePoint list, like this: <xsf:field sharepointName="Title" infopathName="Title"></xsf:field>Pay particular attention to the spelling of the "sharepointName" for each column - this is how that field must be spelled in the XML file.ScottAnonymous
June 23, 2009
Hello Sir ,Thanks for your reply !!i followed all your steps what you suggested , and the field name of CAML file and manifest.xsf file both are exactly same , but i found one mistake in my CAML filethat should be as follow...<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name="Title"></Field> <Field Name="FirstName"></Field> <Field Name="LastName"></Field> <Field Name="Email"></Field> <Field Name="Phone"></Field> </Method></Batch>here in " <Field Name="Title"></Field>" , you mentioned single quote around Title !!!and i guess jsut coz of this thing people not getting data in list !!!i am really very thankful to you that ultimetly i resolve this problem wht you suggested to me !!!Thank You very much again :) !!Thanks & Regards,Dipti ChhatrapatiAnonymous
June 23, 2009
Hi Dipti,Hmmm...that is odd as I re-use the same XML file over and over again for testing and the Title field uses the single quote. So I am certainly glad to hear it is working <g> I am not sure why that would be the issue.But as long as it is working...all is well! :)Take care Dipti,ScottAnonymous
June 30, 2009
I'm an end-user (content administrator), not a developer, so hopefully my question will make sense to you. My company is implementing InfoPath 2007 very soon and I am wondering if it can work with an existing SharePoint list? Specifically, will the survey form I create using InfoPath allow the user to edit and overwrite their response (which is already stored in my existing SharePoint list)? I'd like to be able to use the existing data and not make the user re-input it into a blank SharePoint list. Thanks for your help.SteveAnonymous
June 30, 2009
Hi Steve,In order for InfoPath to be able to update items that already exist in a SharePoint list, you will need to write code (samples are in these blog comments.) However, since you are asking about a survey you may want to post that question to a SharePoint blog as it may be easier to just use SharePoint features for that. I'm not trying to steer you away from InfoPath but you really would need to know code to update existing items. If, however, all you want to do is "add" the survey responses to an existing list then this post would allow you to do that.ScottAnonymous
July 07, 2009
Hi Scott and thank you for this post. Maybe you have already answered to my question but I have a problem.Your tutorial works fine and I can send datas to my SharePoint list. But I can't change the value of the textboxs used to send the form. Indeed, in the XML file, I can only set static value such as<Field Name="Title">Test</Field>Instead of using a static value (in my example : Test), is it possible to set a value of an other textbox used in my main data source.Thanks.MaximeAnonymous
July 07, 2009
Hi Maxime,If you are using the default form design here in this post, then you will need to include the "Title" field on the form so the user can enter the appropriate title. However, if you look further down in the blog comments, I have shown how to re-design the XSN so you can add your own type of fields (i.e. dropdown, date picker, etc.) In this case, you could have another node in the data source, that does not show up on the form unless you want it to, and the value of this node could be an expression based on the other values the user has entered.It is important to note that unless you switch the design to use code, the "other" method I mentioned above for the design will only work if you are using the form in the InfoPath client - it will not work for browser forms.ScottAnonymous
July 08, 2009
I found a good solution thanks to this post. Scott, do you thing that my form will work with InfoPath Form Services despite the custom code ? Is is considered as Managed Code ?ThanksMaximeAnonymous
July 08, 2009
Excuse me, I've forgotten the link : http://www.bizsupportonline.net/infopath2007/how-to-submit-items-rows-repeating-table-infopath-sharepoint-list.htmMaximeAnonymous
July 08, 2009
Hi Maxime,Yes - this is managed code and the code I have provided here in this post, will work in browser forms as well. However, once you add managed code to an InfoPath Form Template, it changes the way in which the XSN gets published and used in your MOSS site.Take a look at this documentation: http://office.microsoft.com/en-us/infopath/HP101000931033.aspx#5 and then this link for the server side steps:http://msdn.microsoft.com/en-us/library/ms772405.aspxScottAnonymous
July 09, 2009
Hi infopath..I was able to learn many things from this blog and did implement the contact list successfully.now I am trying to do the same thing with a excel file I imported as a custom list. But when I try to submit, i get a confirmation message, and nothing gets added to the list.I am not sure but this may be related to the title field, which is not their in my custom list. my list has class, characteristic, and description feilds.this is the exact version of the code i am using and i have double checked my GUID and the site(subsite in my case) i am submitting to.<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name='Title'></Field> <Field Name="Class"></Field> <Field Name="Characteristic"></Field> <Field Name="Description"></Field> </Method></Batch>looking for you reply,,thanksamoghAnonymous
July 10, 2009
Hi amogh,Please be sure to review all the comments in this posting - this issue has been raised a number of times and the suggestions to resolve it are always the same.Now, in regard to your "Title" column being missing, I have not tested this before so I don't know if this is impacting the issue or not. However, even if the Title column exists in the list, it is not "required" to be on of the fields that you include in the XML file to submit to the list. In this case, the Title simply shows as "(no title)" in the list itself.ScottAnonymous
July 12, 2009
Hello Sir ,i did above task successfully before , but now i am suffering from data validation during submission using your technique...!!!is there any way for data validation errors that cannot be submitted until the errors are resolved as when i click on field property for data validation it is showing disable !!!then how can i submit data to sharepoint list with exact data validation !!! please help me out !!thanks & regards,Dipti ChhatrapatiAnonymous
July 12, 2009
Hi Dipti,I am not sure I follow what you are asking - can you provide some additional detail as to what is/is not working?ScottAnonymous
July 13, 2009
thanks for your fast reply !!!well .. in second repeating table scenario u have shown input data functionality .lets say , there is one field " email " , i want to apply data validation for email using custom pattern to enter proper value in email field...then how can i do that , i hope u wud get my query !!thankyou,Dipti Chhatrapati.Anonymous
July 13, 2009
hey infopath,I made a new custom list and opened it in excel to edit it. Once in excel i copy pasted all the data I wanted and now, it works like a charm.only problem while importing a spreadsheet is, you loose the ID column, which is really important while updating the SharePoint list(atleast according to me :D).i still have one more question though..is it possible i can assign a feild's value to a feild in repeating table??? is yes, can you tell me how...once again, thanks for all your help and this blog.Anonymous
July 13, 2009
Hi Dipti,I am assuming you are entering/modifying the email address in the repeating table that is bound to your secondary data connection. As you have seen, data validation is not available through the UI in this case. So there are a couple of options:1) Use code to copy all the rows from the secondary data connection to a mirrored data structure in your mail data source (this gives you additional flexibility in UI features.)2) Use code on the changed event of the e-mail column from your list to test if the value entered by the user is valid. Here is a Knowledge Base article that provides a basic expression for checking an e-mail address:http://support.microsoft.com/kb/308252Then you would use code like this in the "Changed" event for your e-mail field in the repeating table:NOTE: You will need to add the following "using" statement to your code: using System.Text.RegularExpressions;public void MyContacts__Email_attr_Changed(object sender, XmlEventArgs e){ if (!TestEmail(e.NewValue)) { this.Errors.Add(e.Site, "Email Error", "Error in e-mail!"); }}private bool TestEmail(string emailAddress){ Regex emailregex = new Regex("(?<user>[^@]+)@(?<host>.+)"); Match m = emailregex.Match(emailAddress); return m.Success;}ScottAnonymous
July 13, 2009
Hi amoghjain,Sorry but I don't understand what you are asking in regard to assigning a value to a field? If you are referring to Excel, then I won't be able to help but if you are referring to how to do this from Infopath, then please review all the comments in this blog as there have been numerous questions on how to update existing values in a SharePoint list.ScottAnonymous
July 13, 2009
hey,i have a secondary data source(New Entry), which updates a sharepoint list with 3 columns(ID, FirstName, LastName). I want to set a default value for the ID column, which depends upon another feild.For example, i have a field name "Id_User" in the infopath form, and I want to assign this fields value in the ID field of the repeating table.can you tell me how to do to this???Anonymous
July 13, 2009
Hi amoghjain,Thank you for the clarification. I am not a SharePoint expert but I don't believe their ID column is updateable. This is an auto-generated value when you add an item to the library or list. If you wanted to generate your own "ID" you would need to create your own "customID" column and this is what you would update.If this works for you then you can use the "concat" function in a Rule to set your custom ID column. It would look something like this: concat(<SelectYourField>, "_Test")Where "SelectYourField" would be where you use the "Insert field or group" button to select your field and "_Test" could be any text or another field.ScottAnonymous
July 13, 2009
thank you very much !! scott !! :)Anonymous
July 14, 2009
here is my code and now i can submit to a repeating table from any feild in infopath..:D(i am a co-op student)function CTRL61_15::OnClick(eventObj){var root = XDocument.DOM;var Definition_ID = root.selectSingleNode("/my:myFields/my:User_Definition_Modify/my:ID").text;var User_Definition= root.selectSingleNode("/my:myFields/my:User_Definition_Modify/my:User_Modified_Definition").text;var batch = XDocument.DataObjects["Update Item"].DOM;batch.selectSingleNode("/Batch/Method/Field[@Name='ID']").text = Definition_ID;batch.selectSingleNode("/Batch/Method/Field[@Name='DEFINITION']").text = User_Definition;XDocument.DataAdapters["Modify"].Submit();XDocument.UI.Alert( "Change Request has been successfully saved" );}Anonymous
July 14, 2009
Hi amoghjain,Glad you have what you need!ScottAnonymous
July 16, 2009
The comment has been removedAnonymous
July 16, 2009
Hi Bev,That is an odd error that I don't believe is specific to what you are doing in regard to this post. Try this:Test #1:Close all instances of InfoPathClick your Windows Start button and choose Run Enter this command: infopath /cache clearall Click OK Once InfoPath launches, close it and try to open your form again If the above did not resolve the issue, try these steps:Create a new, blank XSNAdd a receive data connection to the MyContacts list Display the Data Source Task Pane and drag MyContacts to your view as a repeating table Preview the form and make sure you see the data Save and close the form Simply double-click the saved XSN - what happens? If this works, then proceed with publishing this new XSN to your SharePoint site and test again from SharePoint - what is the result? ScottAnonymous
July 16, 2009
Does the InfoPath form have to be published to SharePoint, or can it be used offline and published to my computer? Because if it has to be published to SharePoint, then that's probably why I am getting this error.What I am trying to do is submit data to a SharePoint list using InfoPath, but not have the InfoPath form in SharePoint. Is that possible?Anonymous
July 16, 2009
Hi Bev,No - the InfoPath Form Template (XSN file) does not have to be published to SharePoint...it can be published to your machine, network share, etc. and you will still be able to update the list.ScottAnonymous
July 17, 2009
I tried both your suggestions and it did not work. I still get the same message. It is unable to open the MyContact list once I save the form and close it.Anonymous
July 17, 2009
I wonder could it be because we have to reach our SharePoint site using a Smart Card. We have pick a certificate when we login, could this be preventing the retrieval of the list because it is wanting a certificate.Anonymous
July 17, 2009
Hi Bev,That may be the issue...I've not done much with Smart Card logon so I am not 100% sure.ScottAnonymous
August 24, 2009
Hi Scott,I followed your steps explained in "January 05, 2009" and can successfully submit the data and they show on the Sharepoint list. However the choice fields still show as Text, I need to manually type them while filling the form. Is there any way to choose between from A, B or C like explained in your example. Or I will be also happy if there will be A, B and C and I select them with a checkbox or radio button. Anything other than manually typing them is appreciated.Thank youAnonymous
August 25, 2009
The comment has been removedAnonymous
November 15, 2009
If you run through this and have a problem with it not creating a new item in your list . . . even though it says "Submitted Successfully" . . . try this solution: (found at: http://msdn.microsoft.com/en-us/library/cc162745.aspx#ip2007SubmitDataSPList_OverviewofSubmittingDatafromInfoPathForms)For the data connection to the Lists Web service to work correctly, the URL you enter must correspond to the location of your MyContacts list. If the list is located directly off the root Web of your SharePoint server, the URL will be in this form:http://servername/_vti_bin/lists.asmxIf the list is located in a site on your SharePoint server, the URL will be in this form:http://servername/sitename/_vti_bin/lists.asmxAnonymous
December 17, 2009
i have scene this senario everywhere on the net, the problem I have is that it only deals with a textbox type data. how does this caml code apply when your using datepickers in infopath or set up "Choices" in the sharepoint list. I was able to create a sharepoint list based on this approach. Then I expanded to the real world and added dates and logic. interestingly infopath previewed fine. I loaded the form in to the forms side of sharepoint and it ran fine, but did not load the list file. So could you expand this sample to use dates in the sp list and show how to import into infopath. thanks for your timeAnonymous
December 17, 2009
With infopath you can have multiple "sections" or repeating tables. these may include dropdowns, radiobuttons, text boxes etc. All setup when configuring the list in sharepoint. Is there a way in the caml code to direct the various columns of a Sharepoint List in such away to populate say the address part of the infopath form, and the other columns to the date secton and finally other columns to the list boxes, dropdowns, radio buttons etc? is that what the method id is for? if so how can you steer the code to setup infopath. I expanded on the sample code and it shot off the screen with all the column detail? A page look was more of what i was looking for.please advise.Anonymous
December 20, 2009
Hi wizardntexas,In regard to datetime and choice type columns, take a look at my comments dated September 16, 2008 and January 5, 2009 .In regard to your second question, I am sorry but I don't follow what you are asking.ScottAnonymous
January 19, 2010
The comment has been removedAnonymous
February 05, 2010
The comment has been removedAnonymous
February 05, 2010
Second question on the infopath form it shows all of the current projects in the project list I don't want to do that I only want to show the fields for the user to submit a new project to a project list in SharePoint.Anonymous
April 28, 2010
The comment has been removedAnonymous
April 29, 2010
Thank you Scott for the excellent post!I was able to successfully submit a new record to my list. I would like to be able to edit and update existing list items as well. I expect this will be a variation on the theme you established here, but I have not been able to muddle through to the solution. Can you outline the process for me or point me to an appropriate post that will help me on my way?Your help is very much appreciated. Thanks!DavidAnonymous
April 29, 2010
Hi David,Thanks...do perform and edits, deletes, etc. you will need to use code. Take a scan through the comments and you will find sample code on exactly how to do this.ScottAnonymous
May 03, 2010
HDMorgan,Are you using the initial process documented in this blog post or are you using code to perform the submit? If you are using the initial process then you will want to make sure you have mapped the "submit" options appropriately as documented in step #6. If you are using custom code to perform the submit, then you will need to debug your code by stepping through it to see where the code fails.ScottAnonymous
May 28, 2010
This tutorial worked great for laying the foundation. In our case, we have need to implement several dropdown boxes that will use another SP list for the data source and we also have some forms that will need to have checkboxes. Any suggestions for how to accomplish this without a ton of coding?Anonymous
June 01, 2010
In response to the last comment from username stuckinoregon:You can find out more about getting data from SharePoint lists into InfoPath 2007 forms on office.microsoft.com/.../HP100931601033.aspx.If you're using InfoPath 2010, check out the following blog posts for details on improvements that we've made to SharePoint list data connections in this release:blogs.msdn.com/.../sharepoint-list-data-connections-in-infopath-2010.aspxAnonymous
June 14, 2010
How do I add the data from the repeating section of a Infopath form to Sharepoint???? I want the repeating section to be treated as data by itself. Currently, the only way to view the data in that section is by opening the form which I dont want any help.Anonymous
June 14, 2010
Great article. Im new to CAML and wondering will it work on multiple lines of text? I have a list for agenda items and one of the column contains multiple lines, how would I write the CAML template? ThanksAnonymous
June 20, 2010
The comment has been removedAnonymous
June 24, 2010
Hi Scott,Thanks for the suggestions. I checked every comments posted and found the alternative method to submit combo boxes, rich text, etc. I got it to work too.Now, my next question is...is it possible to submit multiple entries (repeating table) all at once? My form contains repeating table but the 'submit' button only submits the 1st entry in the repeating table. I would like to submit all the entries in the SP list upon clicking the submit button.We are using IP2003/SP2003. I searched and read thru various similar blogs but I could not find anything I could use. I can only use vbscript/jscript. Would you happen to know any other alternatives??Thank youAnonymous
July 07, 2010
The example shown makes all the controls used to submit text fields. How can I modify it so that I can use date contols, dropdowns etc to submit data?Anonymous
July 07, 2010
Hi Alphamax,Take a look through the comments - I have provided steps on how to modify the design to use other types of controls.NOTE: Without using code, the new design will only work with the InfoPath form opened in the rich client. If you need to use your form in the browser, you will have to add code for this new design to work and once again, there is sample code in the comments for this as well.ScottAnonymous
July 29, 2010
This method is very helpful for me, but I have one problem:I don't want to import the values mannualy, I just want to set column's value in the rule of submit button. But I have to set the "Field" parameter of xml data connection so all of columns return the same data.Anonymous
August 01, 2010
Hi Armaghan,If you are using InfoPath 2007 with Microsoft Office SharePoint Server 2007 then browse through the comments in this post - you will see alternate methods for entering the data. There is a way to do it as you ask but your form template must be a "client only" design - if it will be used in the browser, it will have to be code. Both options are in my various comments in this post.Now, if you are using InfoPath 2010 with SharePoint 2010 then you now have the ability to customize a list using InfoPath and that custom form design will then be used to add/edit your list items!ScottAnonymous
August 27, 2010
The comment has been removedAnonymous
August 27, 2010
The comment has been removedAnonymous
August 31, 2010
Is this solution compatible with infopath browser forms?Anonymous
August 31, 2010
Hi Ben,If you are referring to the steps as documented in the original post, then yes. If you look through the numerous comments in this post you will see other methods for implementing this and depending on which method you choose will depend on whether that solution will be compatible with the browser.ScottAnonymous
September 07, 2010
Why is this dated 2007 and titled Info Path 2010?!?!Anonymous
September 24, 2010
Hi Scott,This is great post but how do you call/Invoke this InfoPath form from SharePoint List --> New --> Item?Anonymous
September 26, 2010
Hi HR,If you are using InfoPath 2010 with SharePoint 2010, then this post would no longer apply as you can simply use InfoPath to customize your SharePoint list form. However, if you are still using the 2007 versions then you would need to provide a link (say on your main landing page) that would simply invoke this form. I am not a SharePoint expert but I don't know of any way to customize the New | Item link to point to this form. So instead of having your users go to the list, simply provide a link to the published XSN.ScottAnonymous
September 29, 2010
Actually, this method here is great for 2010. You can use the steps outlined here (with a few tweaks) to alter the default form on top of a list in order to bring in the data from a 2nd list (probably linked to the first) and make it read/write as well rather than just read only. Very very handy.Anonymous
September 29, 2010
Actually, this method here is great for 2010. You can use the steps outlined here (with a few tweaks) to alter the default form on top of a list in order to bring in the data from a 2nd list (probably linked to the first) and make it read/write as well rather than just read only. Very very handy.Anonymous
September 29, 2010
The comment has been removedAnonymous
September 30, 2010
Hi Faraz,Wow - I can honestly say I have never seen that behavior. :) So if all the fields are blank, how do you know an item is getting added to the list? (Just out of curiosity <g>)So - if you have gone through things like this:Making sure you are calling the "lists.asmx" web service at the same level as your listChecked the InfoPath manifest to be sure of the SharePoint column names Confirmed the capitalization of your field names in the manifest Try modifying your XML file to include just the Title and one other field (non-required field) - see if there is any change And if you truly see a new row in the list then the above are probably ok, then I honestly am not sure what could be causing this. The best option may be to open a support case so we can take some time and dig into this with trace files, etc.I wish I had a better answer but I cannot even reproduce this to try and determine what is going wrong. :)ScottAnonymous
October 07, 2010
Scott,I managed to figure out what went wrong. I had to follow instructions to modify the Manifest file in the infopath form... for reference, I followed the directions on the following website, that told me to apply some rules to Sync the Main fields with the XML fields of the Batch node...algahtani.net/.../tracking-infopath-forms-using-sharepoint-listsI also had to re modify the manifest file according to this website:www.infopathdev.com/.../55159.aspxAs you can see, the tags that looked like this, ".../Batch/Method/Field", in the manifest file (under the rules section) needed to be modified to ".../Batch/Method/Field[@Name='FieldNameOnInfoPathForm']". Once I did these two, the form was no longer inserting blank records.If you could modify your instructions to include this situation, or at least reference to the said websites, it would help a lot of people out. If not, hopefully they read my comment and have something to work with.Once again, thanks for the advice!FarazAnonymous
October 07, 2010
Hi Faraz,I am glad you were able to isolate the problem! For note, I do believe I have this documented on page 15 of the blog in my 9 Jan 2009 10:10 AM comments for another user.The original post was not designed to be setup this way so these steps did not come along until later.ScottAnonymous
October 12, 2010
Great Article,But I am facing an issue,I am not able to change the Created By field.As using this technique all the data is inserted from System Accout.I want to change the Creatd By from the Code.Is this possible. Please reply asap. ThanksAnonymous
October 12, 2010
Hi Devubha,It is my understanding that the only way to modify the "created by" and "modified by" columns is to use the SharePoint object model, which would mean code that needs to run on the server and not the client. You could do this with code behind InfoPath if your form was only running in the browser or you could create a custom web service and have your InfoPath form submit the list data to the web service and then have the web service code add the item to the list and subsequently update the created/modified by fields.ScottAnonymous
October 13, 2010
Will someone either:a) remove "Infopath 2010" from the top of this blogb) remove all InfoPath 2007 articles from this blogI'm sick of trying to search for InfoPath 2010 documentation and continually finding 2007 info.Anonymous
October 24, 2010
Thanks Scott/Matt for such a wonderful information..I followed the steps mentioned by you and its working fine but i have to submit the mutliple items(add more items) to the Custom List. Is it possible through the approach mentioned above(no code).Thanks in advance.Anonymous
October 31, 2010
Hi Lovekush Kumar,If you need to submit multiple items (i.e. multiple rows of data) then the only way to do this is with code as you would need to loop through all your rows and add each one to this list. The only way to enumerate multiple rows of data in an InfoPath form is via code.ScottAnonymous
November 05, 2010
Hi,I am trying to populate all Sharepoint lists in a Infopath ListBox Control using List Webservice with Getlist method. But it is getter Alert message , when i click the "Next" after select the Getlist Method.Message: Infopath was unable to create a schema from the results of the web service callPlease guide me , how to populate all listnames in the listbox control.Thanks in AdvanceMAK...!Anonymous
November 26, 2010
Please I need help, I sent this message in InfoPath 2007:InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="schemas.microsoft.com/.../">The system cannot find the file specified. (Exception from HRESULT: 0x80070002)</errorstring></detail>Anonymous
November 29, 2010
Hi Eduardo,I would suggest enabling Verbose logging on your SharePoint site (for all categories), reproduce the error and then check the ULS logs.What happens if you follow the exact steps in this post (and by exact I mean the same names, etc.)?ScottAnonymous
November 30, 2010
Hi Scott,I think this may be what I'm looking for, but perhaps I can explain and you could tell me if there is an easier approach.I have InfoPath 2010 form displaying a SharePoint 2010 list item. There is a secondary data connection displaying a related SharePoint list via a repeating table. I want to add a new item to the secondary data connection.Do I need a Submit data connection to a Web service? or is there a more direct approach?Thanks,SamAnonymous
November 30, 2010
Hi Sam,There is no way from the UI to "submit" data to a secondary data connection as it is a "Receive" connection. You would need to have a separate connection (web service would be best) that takes the data and submits it to the data store that backs up that secondary connection.ScottAnonymous
December 21, 2010
tutorial was very easy to follow, thanks. how can I incorporate combo boxes or radio button selections?Anonymous
December 21, 2010
Hi Dave,I know there are a lot of comments on this post but if you wade your way through them you will see some alternate design options so you can use other types of controls. Now depending on how you go about this some of the design options will only work if the form is used in the InfoPath client but I have noted that in my comments where I have documented the design changes.ScottAnonymous
December 22, 2010
Hi Scott,very nice article on this issue.However, I did all this steps but getting below error when clicking on submit button (in preview)"InfoPath cannot submit the form.An error occurred while the form was being submitted. "I checked GUID value twice, but it failed.Pls advice where i got wrong.ChintanAnonymous
December 23, 2010
The comment has been removedAnonymous
December 23, 2010
Hi Scott,I read your useful post. I did all steps, but somehow my form was not submitted while clicking on submit button. But, finally i found solutionSolution/Correction:Scott's Webserive URL: http://servername/_vti_bin/lists.asmxMy Corretion: http://servername/sites/SiteColletionName/_vti_bin/lists.asmxAfter updating this URL I was able to submit the formChintanAnonymous
February 11, 2011
Hi Scott,Thanks for the great article. I have a question. If I want only to update a single instance from the list, what do I do? Let's say, I have a custom list with some custom columns. Under that I have multiple instances. I'll get the single specific instance value to InfoPath(No problem here), then I want the value of one column from the specific instance to be changed/updated. Could you tell me How to do that?Thanks.Anonymous
February 17, 2011
Hi Eric,How would you like to do this? Code or no code?ScottAnonymous
March 15, 2011
Hi,sorry for my bad english.I would like to change some fields after I have created them.For example:I created:TestScottHeimsomeone@hotmail.com555-1212now I would change the email in somebody@hotmail.com after i created the listitem.I will only update the emailfield. I dont want to delete this and create a new one.Is that possible in the form? I can change the emailaddress. But if I click on submit the emailaddress is the same as befor. It is someone@hotmail.com an not somebody@hotmail.com.best regardspatrickAnonymous
March 15, 2011
The comment has been removedAnonymous
March 16, 2011
Hi Scott,nice to hear from you so soon.I created a second xml:<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="Update"> <Field Name='Title'></Field> <Field Name="FirstName"></Field> <Field Name="LastName"></Field> <Field Name="Email"></Field> <Field Name="Phone"></Field>
</Method></Batch>I named it: updateitem.xmland added the above xml to a new dataconnection.dataconnection -> receive -> xml -> updateitem.xmlBut what is the next step?Sorry, I´m still a newbie in InfoPath...Patrick<Field Name="Test"></Field><Field Name="Ampel"></Field><Field Name="ID"></Field>
Anonymous
March 16, 2011
Hi Patrick,So assuming you created a sample as per the steps I have in the initial post of this blog, you would simply launch your InfoPath form and fill in all the fields in the table, including the one you want to update and the SharePoint ID for the item you want to update. When you submit the form to the web service, it should then update that one item. So a couple of key points:If you only enter in the data you want to change, then all other fields will be cleared out since they exist in the XML file and they will be submitted as well. As such, if you leave them blank the values in the list will be cleared. So you need to be sure to fill in all fields including the one you want to change.For this to work, you must know the SharePoint ID for the list item you want to update. If you add a data connection to your list, be sure to include the ID column so you know which one you need to update. ScottAnonymous
March 29, 2011
Hi,Can I submit data to sharepoint list with lookup fields?Anonymous
March 29, 2011
Hi calvaradog,Yes - you just need to be sure to submit the correct "data" - what I mean by this is the following: if you are using a lookup field, it may be storing the "numeric" value of the option (i.e. 1 - Red, 2 - Blue, etc.) so you would need to submit the numeric value for the selected item if this is the case.ScottAnonymous
April 28, 2011
The comment has been removedAnonymous
April 29, 2011
Hi Richell,The URL to the "lists.asmx" web service will depend on where your list resides. Here are some examples:If your list is on the root site (i.e. http://server/lists/yourlist) then the web service URL will look like this:http://server/_vti_bin/lists.asmxIf your list is under a subsite (i.e. http://server/site/lists/yourlist) then the web service URL will look like this:http://server/site/_vti_bin/lists.asmxIt is very important that you get the web service URL correct. The easiest way to insure this is:Open Internet ExplorerNavigate to your list Copy the URL in the Address Bar "up to" the word "Lists" in the URL - that is the base URL you will use. Then just add to that: /_vti_bin/lists.asmx and you should be good. ScottAnonymous
May 17, 2011
Hi,Great post, worked for me first time.If I want to use this on an already existing list with dropdown boxes, content types and so how will I proceed?I want the already existing list to feed some information into my fields using dropdowns and also is there nothing I can do about the form design? Do I absulutely have to use a 2 column table or can I design the form myself and somehow map the fields on the form to infopath?Thanks.Anonymous
May 18, 2011
Hi Latte,If you scan through all the comments you will get to a section where I have provided complete steps on how to change the form design.ScottAnonymous
June 17, 2011
The comment has been removedAnonymous
June 19, 2011
Hi Jake,There should be no reason why this sample would not work in the browser as I do this without issue. If the error refers to something in the Add List Item Template.xml file, can you please copy/paste the contents of that file so I can see if anything seems odd?Thanks,ScottAnonymous
June 28, 2011
I followed this article but when I click on the Submit button I get the following error.InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="schemas.microsoft.com/.../">The system cannot find the file specified. (Exception from HRESULT: 0x80070002)</errorstring></detail>I am not sure which file the System can not find ... Any idea ?Anonymous
July 07, 2011
How update list items? I's used this solution but I can´t update.Also, I'm used CAML command but doesn't work.Anonymous
July 08, 2011
Hi Claudia,If you look through all the comments for this blog you will see I have previously provided sample code to perform additions, edits (updates) and deletes.ScottAnonymous
July 08, 2011
Hi Dhaval,I really am not sure what file it is looking for - I know if you follow the initial steps in this post as they are documented, it works so it sounds like something may have been missed.ScottAnonymous
August 16, 2011
Hi Scott,I'm getting the same error message as Dhaval. Any thoughts yet on what's I might be doing wrong? The only spots in your directions where I felt somewhat unsure were in step 6. First, when did we add an “Add list Item Parameter” data source? Should that just show up automatically? Mine is called "Add List Item Template"... Was I supposed to change that somewhere? Second, I'm not sure I'm putting the right thing before /_vti_bin/lists.asmx. How much of the sharepoint list address should I be including as part of the servername?Okay, thanks very much for your help!Confused :-/Anonymous
August 16, 2011
Hi "Confused" :)If I have text that the XML file was to be called "Add List Item Parameter" then that was incorrect and it should be "Add List Item Template.xml". Now when you add that file as a "Receive" data connection it will automatically appear in the Resource file list but without the extension (i.e. Add List Item Template).In regard to the URL for the correct "lists.asmx" web service, you need to use the SAME base URL as where your list was created. So let's assume you created your list at the root site collection so the URL would look like this: http://yourserver/lists/yourlistname - if this is the case, then the URL for the web service would be: http://yourserver/_vti_bin/lists.asmx. However, if your list is at a subsite like this: http://yourserver/yoursite/lists/yourlistname then the URL for the web service would be: http://yourserver/yoursite/_vti_bin/lists.asmxDoes that help?ScottAnonymous
August 17, 2011
Hey Scott,Thanks so much for the response, works like a charm!!You rule. Seriously. Awesomeness.:)Anonymous
August 17, 2011
Hey,Sorry to bother you again, but I am totally stuck... I've been going through the comments (to no avail) trying to figure out how to set this up to handle drop downs, radio buttons, yes/no boxes, and other stuff, beyond simple text boxes. Any suggestions as to websites, tutorials, anything(please!) that might help? I'm at a loss :(Thanks!Anonymous
August 17, 2011
Hi Confused,No problem :). The best solution will be to find the steps I have previously provided in these comments. There are complete steps on how to modify the design of your XSN to use other controls. Note that if you are developing a browser form, you will need to use code. There is sample code in the comments as well.ScottAnonymous
August 18, 2011
Okay, so I really have no clue what I'm doing here. I don't think I'm developing a browser form, but I'm not sure... All the users have infopath installed on their computers, so maybe I'm not? I have read every single comment on this site and other than the sample code (which I have no idea how to use), I still don't understand how to change the form. Is there a book or something you can recommend? The comments/answers seem to be a little too advanced for me. :(ThanksAnonymous
August 18, 2011
Hi Confused,I don't know of any books, sites, etc. that would explain this any clearer than what I have done in the post comments. If you are truly unfamiliar with InfoPath then these steps will be challenging. There is training on InfoPath (office.microsoft.com/.../HA102227501033.aspx) and this will probably be of use for you to get a handle on InfoPath but there is nothing in there specifically to this post.ScottAnonymous
August 18, 2011
Are all the changes I'm going to make going to happen in the manifest.xsf file? Will I need to make more than one xml template for each type of control and/or section I want to add? Thanks againAnonymous
August 18, 2011
Just kidding, all fixed, thank you!!!!!!Anonymous
August 23, 2011
I'm back. I'm trying to make a version of my form for query/update purposes. I saw your post about this ("public void ctrl26_5_clicked..."). Do I just copy and paste this stuff into the manifest file, replacing the field names with my own?Thanks!Anonymous
August 29, 2011
The comment has been removedAnonymous
August 29, 2011
Hi Rod,Not sure I follow the confusion...you are simply adding a "Receive" data connection to the SharePoint list called MyContacts...assuming you named it MyContacts. So whatever your sample list is called, simply add a data connection to that list.ScottAnonymous
August 29, 2011
Scott,Thanks for replying. I am trying to following the instructions as written above. When I get to Step 5 there is no MyContacts data connection in my drop menu. Reading step two is a bit confusing as I am not sure exactly what i am doing.Create a new, blank, browser-compatible form template I can do thatAdd a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2. (Make sure the options “Include the data as a resource file in the form template” and “Automatically retrieve data when the form is opened” are enabled.)I did that by adding the field to the CAML Template.XML file was this wrong? Add a “Receive” type secondary data connection to the “MyContacts” SharePoint List created in Step #1 When i do this am I supposed to use the CAML template to create this data connection? Not clear to me and make sure the option “Automatically retrieve data when the form is opened” is enabled.NOTE: Be sure to include the “Title” field along with the custom fields we created.Anonymous
August 29, 2011
Scott, are you there? I really need your assistance, I have looked at serveral instructions and your appears to be the most accurate. I signed in as my name is Big Rodney W My comments are under Rod Need your Help!! Please titleAnonymous
August 29, 2011
Rodney - I don't mean to be a wise guy with this statement but if you are having trouble adding a data connection, getting this post to work for you could be problematic.At any rate:Did you create the list on your SharePoint site? If so, what did you call it?Depending on the version of InfoPath you are using, either go Tools -> Data Connections (for 2007) or select the Data tab and click the Data Connections button (for 2010) - do you see a "Receive" data connection to the list you created on your SharePoint site? If not, you need to add it. While here in the Data Connection list, click Add and then select the "Receive" type of data connection. Choose to create a data connection to SharePoint and then walk through the rest of the data connection wizard. You may want to take a look at this information before going any further with this post:If you have InfoPath 2007:InfoPath 2007 Training Labsoffice.microsoft.com/.../HA102227501033.aspxIf you have InfoPath 2010:InfoPath 2010 Training Labsmsdn.microsoft.com/.../gg180739.aspxAdding data connections and using them as sources for your controls is basic InfoPath functionality. You need to be comfortable with the basics before digging into something like this.ScottAnonymous
September 29, 2011
Hi Scott,I've successfully set this up, but have one question: Are submissions made via this method anonymous? I'd like to set up a "survey" type form, but it's really important for the users that the resulting records aren't traceable to the submitter. (I know there's a survey feature built into SP, but it's not truly anonymous, so it won't work for my purposes.) Using your method, I can't find anything pointing to who's submitted what (there's no "modified by" column), but I wanted to double check with you because - well - you're the expert.Thanks!Anonymous
September 29, 2011
Hi "Question" :)It sounds like you may not have the "Created By" and "Modified By" columns showing in your list? This sample should not be submitting anonymously - now I am not a SharePoint expert but I know you cannot "submit" an InfoPath form directly to a "library" anonymously; however, I have not tried this with a list. My suspicion though is the user that submitted the list item will appear in the Created By and/or Modified By fields.ScottAnonymous
September 30, 2011
Yeah, you're totally right, my mistake. So as far as you know, there's no way to override the automatic Author and Editor fields? Frustrating. Thanks for your answer, though. I appreciate it.Anonymous
October 03, 2011
Hi "Question" - the only way I would know to do what you need would be submit to a custom web service that takes the data from the XML file and adds it to the list. Then all entries would come in under the same account...whatever the identity account is for the web application.Short of writing a custom web service for this, I don't know of a way to submit to a list anonymously. You may want to ping a SharePoint forum on this for ideas as I am not a SharePoint expert.ScottAnonymous
December 01, 2011
I am new to InfoPath and SharePoint. I have been trying to submit data from InfoPath 2003 () to SharePoint list.My list GUID is in format {95EF64EA-0FC0-45F3-B00A-212CF8AEFEA6}My CAML is: <?xml version="1.0" encoding="UF-8"?><Batch OnError="Continue" ListVersion="1" ViewName="{79FFC957-EE73-4653-868D-34D4CA6DC75}"> <Method ID="1" Cmd="New"> <Field Name='Title'></Field> <Field Name="ProgramName"></Field> <Field Name="PGM"></Field> <Field Name="PMT1"></Field> <Field Name="PMT2"></Field> <Field Name="PMT3"></Field> <Field Name="PMT4"></Field> <Field Name="PMT5"></Field> <Field Name="PMT6"></Field> <Field Name="PMT7"></Field> <Field Name="PDQOS"></Field> <Field Name="Platform"></Field> <Field Name="Folder"></Field> <Field Name="MS"></Field> </Method></Batch>!!! Do I need to add <Field Name="ID"></Field> to my CALM file !!!I added a "Receive" type secondary data connection to my CAMLI added a data source (receive) to the sharepoint list required. I added a "Submit" type of web service data connection to the "lists.asmx" web services (http://servername/sites/mysite/_vti_bin/lists.asmx); with the "UpdateListItems" method;Provide my list GUID to "listname" parameter; and select my CAML data source to "updates" parameter ("BATCH" and"XML subtree, including selected element")It is a simple form that just wants to submit to the list.When I preview the form - I can enter the values and submit. I then get NO response (No Error) but the new item was notadded to the SharePoint list.Any Help is greatly appreciated.() I create the InfoPath 2003 form from InfoPath 2010 (using compatibable option). is there any differences fromthe sample that I should aware to correct my issue?my email is haichautrinh@yahoo.comThanksAnonymous
December 01, 2011
Hi Tricia,I know there are a lot of commments on this post but if you read through them, the behavior you are experiencing is addressed throughout this post. In short, there are a number of "failure" points where you can see this behavior:1) Make sure you are using the correct URL for the "lists.asmx" web service. For instance, if you list is located off the root like this: http://server/Lists/ListName then the submit URL would be like this: http://server/_vti_bin/Lists.asmx. However, if your list resides in a subsite like this: http://server/site/Lists/ListName then the web service URL would be like this: http://server/site/_vti_bin/Lists.asmx2) Make sure your "Add List Item Template" XML file contains the actual "SharePoint" column name. For instance, say you create a column in your list named: My Column but afterwards realize you don't want it to have a space. If you go back to your list and rename it without the space, the underlying SharePoint column name will still have the space and it will be encoded like this: My_x0020_Column. It is this name that needs to be in your Add List Item Template XML file. Here are the easiest steps to determine the actual SharePoint column names for your columns:Create a new, blank InfoPath Form Template (XSN) - I create a new one just so you can throw it away when this is done.Add a Receive data connection to your list AND be sure to include all the columns you have added to your Add List Item Template XML file Create a new folder on your Desktop named: SourceFiles From the File tab in InfoPath 2010, choose Publish and then select "Export Source Files" Select the SourceFiles folder and click OK (you can now close completely out of this InfoPath form) Navigate into the SourceFiles folder, right-click on "manifest.xsf", choose Open With and use Notepad to open this file Do a Search in Notepad for this: <xsf:dataObjects> Once you find the above node, if you look below it you will see your SharePoint list connection information. In these nodes, you will also see entries like this: <xsf:field internalName="Title" required="yes" type="Text"></xsf:field>Pay particular attention to the "internalName" attribute - whatever is specified here for your column name is what MUST be in your Add List Item Template XML file. Make sure of the spelling AND capitalization.3) Once you have completed the above steps, if the update still does not work then I would suggest (make a copy of your Add List Item Template XML file) removing all but one of the fields you have in this file and see if you can get that one field to update correctly. If so, then continue to add them back until you find the one(s) that cause the process to no longer work. For instance, if any of your columns are a Date and Time column, then you have to have the value entered in a specific format.Hopefully some of this helps! The information above (along with other suggestions) are throughout this blog.ScottAnonymous
December 01, 2011
I am getting this error message and cannot figure out how to fix it i followed all the directions above.Darren Weissdweiss@nybloodcenter.comInfoPath cannot submit the form.Some rules were not applied.InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="schemas.microsoft.com/.../"> List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. </errorstring><errorcode xmlns="schemas.microsoft.com/.../errorcodAnonymous
December 06, 2011
Hi Darren,The first thing to check is that the URL to the "lists" web service is at the same "level" as your list. For instance, if your list is here:http://server/lists/YourListThen the web service URL for the lists web service would be:http://server/_vti_bin/lists.asmxHowever, if your list is on a lower subsite like this:http://server/site/lists/YourListThen the web service URL for the lists web service would be:http://server/site/_vti_bin/lists.asmxI would start by double-checking you have the correct "lists" web service URL. If it does not point to the same "level" (site) as where your list lives then you will get an error that the list cannot be found.ScottAnonymous
December 18, 2011
Hi Scott,How will I save my infopath in offline mode. My req is that I need to fill the infopath as many times as I can when I am in offline mode, save it as xml and then submit them to the sharepoint.Anonymous
December 18, 2011
Hi Heerachand,You will need code for this but it is really no different than any other offline InfoPath form. Your code will need to:Check if the user is online or offlineIf offline: - Submit the form (the entire XML file) to a local folder - When the user comes back online, your code will need to enumerate all the XML files in that folder and submit them individually to the list. If online: - Submit to the list ScottAnonymous
January 12, 2012
Hi Scott, I've adapted the steps above to update rows in a sharepoint list instead of adding new rows, and it works fine. However, I don't want users to actually see the repeating rows of data, I would rather set them 'behind the scenes.' In my rules I have tried to set the repeating fields, but so far it's updating all the 'field' rows in the repeating table to the same value even though I set my rule to update based on the @name.This is what I have in two separate rules:Set Field to 1 where @Name=IDSet Field to Reserved where @Name=StatusThis is what I get back:ID=ReservedStatus=ReservedAny suggestions would be greatly appreciated.Anonymous
January 13, 2012
Hi Matt,I know its a lot of comments on this post but if you look through them you will see that you need to use code. Rules cannot be used to set data in a repeating structure. At various points in the past, I have provided sample code for this process.Thanks,ScottAnonymous
January 23, 2012
I am hitting two issues with this tutorial. The first is if I have the following CAML:<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New">
</Method></Batch>The form will successfully write to the list, but it wont record the title that i provided. Instead, when navigating to the sharepoint list it says "(no title)".If I update the CAML to be <FieldRef Name="Title"/> I get the following error:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="schemas.microsoft.com/.../">Cannot access a closed Stream.</errorstring></detail>I also get this error if I add any fields other than the LinkTitle one.<FieldRef Name="LinkTitle"/>
Anonymous
January 23, 2012
Hi Stacey,I am not sure I follow exactly what field you are trying to set - so let me describe what I just tested:Created a new list called: SubmitToListTestBy default, the Title column that you get is: Title (linked to item with edit menu) I added one additional column to the list called: Col1 (NOTE: the actual SharePoint name for this column is: _x0043_ol1 - I am not sure why SharePoint changed "Col1" to "_x0043_ol1" but it did.) Setup my InfoPath Form Template as per the initial post and tested - result: the data submitted and appeared without issue. And in this case, the "Title" column that got populated is the one that is a "link" - meaning I can click on the title. If I am not following correctly, please accept my apologies.ScottAnonymous
January 25, 2012
Hi Scott,Sorry for my delay. I was able to solve my issue (though I've hit a few others.) Basically, I had copied the field references from the code view of a sharepoint list view.. which gave me:<FieldRef Name="Title"/>Instead of:<Field Name="Title"/>(And boy do I feel silly!)I am stuck once again and having trouble finding resources online and have read over the comments on your blog. First let me provide some background information on what I am trying to do.I have two custom sharepoint lists - Event Details and Schedule. This is a 1 to many relationship, meaning 1 event to many schedule items. I want to be able to create and edit items for both lists in a single form.With that said, I am using Infopath & Sharepoint 2010, would prefer to keep it as a browser form and will not be able to use custom code.Do you have any good resources for me? I am able to get the new item code to work, but I need to also have update, delete and filter capabilities.Thanks in advance!StaceyAnonymous
January 26, 2012
The comment has been removedAnonymous
January 26, 2012
THanks for the information Scott! Do you know of a way to set the ID in the CAML dynamically? How I'm envisioning this form is having the receive repeating table with a button that says "delete" and another that says "Update" so that you can modify each row. How do I send the ID to the CAML?Also, do you have any information around filtering the receive connection? I see query fields, and from reading over the InfoPath blog it sounds like you can use those fields to filter.. but I can't seem to figure out how.Thanks!StaceyAnonymous
January 26, 2012
Hi Stacey,Sure - when you add a column to the repeating table to store the buttons, you get a button on each row. As such, when you click the button to set the CAML fields, the values come from the fields on the same row as the button. You will just need to include the ID column from your list.Now the issue you are going to run into is this: how do you actually set the appropriate fields in the CAML file from a button...and this is where it gets tricky. If you read through all the comments in this post you will see I have documented a couple of options for this:1) Hand-modify the manifest so you can specify through a subscript value which node gets which value.2) Use code behind the XSN to set the nodes in the CAML fileSo the problem with option #1 is this: that method will only work in an InfoPath client form. It is not supported for the browser. The issue with option #2 is that you now are adding code to your form template. This method will work for client or browser but you are adding code.Now, if you are using InfoPath 2010 and SharePoint 2010, then in many cases you can still publish your XSN directly to a library even with code! The caveats for this are: the "Microsoft SharePoint Foundation Sandboxed Code Service" must be running and the code that you are executing cannot access anything outside of the site collection. In this case, the code is just manipulating data with the XSN so the only other issue would be if the Microsoft SharePoint Foundation Sandboxed Code Service is running in your farm.Within the comments in this post I have provided a complete code sample for adding, updating and deleting list items so with the new Microsoft SharePoint Foundation Sandboxed Code Service feature of SharePoint 2010 this should be a viable option.I hope this helps!ScottAnonymous
February 25, 2012
This is an awful lot of work just to submit information to a SharePoint list from InfoPath. Why doesn't InfoPath just have a "Submitting to a SharePoint List" wizard to simplify all of this nonsense?Anonymous
February 26, 2012
Dear scoutthanks for your great post,I try to macke contact-coment and coment list view with infopath 2010 ,is this article can help me?i want have contact view with edithing ability and new coment plase and coment list behand it with one infopath form ,i mack it with webpart in web ,but when i whant work with worksoase i have problem with new item coment part ,plese help meAnonymous
February 26, 2012
Charlie - I agree...this is a lot of work to submit to a SharePoint list; however, this is no longer required if you use InfoPath 2010 and SharePoint 2010 (Enterprise) - you now have the ability to create a list in SharePoint and then customize the form using InfoPath! When you publish the modified form back to the list, your InfoPath form is now what will be used for display, edit and new! So now it is much, much better. :)Garni - my apologies but I don't understand what you are trying to accomplish or the problem you encountered. Please provide additional details and I will do what I can to help.ScottAnonymous
March 20, 2012
The comment has been removedAnonymous
March 20, 2012
The comment has been removedAnonymous
March 20, 2012
Hi ScottThanks for the quick response. I will look through all comments as you suggested( lots of coffee) We are running on sharepoint 2007, and no decision has yet been made to change to 2010 :-(BRTroelsAnonymous
March 21, 2012
I know this ios a real old post, but I am stuck using old SW and need some help please.Using this data here in the quest to populate a SP2007 List from a web enabled InfoPath 2007 form, the use of CAML is required. I can't quite figure out what the role of the CAML XML file is. The data connection associated with the CAML XML file "Retrieves" data, but is that only because this write-up uses repeating tables? In my situation, I am not using repeating tables. I am only trying populate a series of existing column in the list with data entered in the web enabled InfoPath 2007 form.What is the role of the CAML XML file when you want to populate a "List" from a web enabled InfoPath form?Thank you for any insight.Anonymous
March 21, 2012
Hi Quized Again,Have you followed the steps in this post? Although it does show on the InfoPath view as a repeating table, you can only submit one item at a time. The CAML XML file is what is used to update the list. Notice the "cmd=New" in the XML file? This is the command to add a new item to a list. If you review all the comments on this post (I know...there are a lot) there are complete steps to submit to a list in other manners. Some are specific to the InfoPath client and some will work in both the client and the browser.ScottAnonymous
April 09, 2012
Dear Scott,Thanks for the post even though I'm thanking over 4 years after the fact. Some of us are still in the stone age... In any case I'm wondering if you might be able to point me in the direction of how to make a custom form without the repeating table. The data constraints are simple, but my customer would really like this form to look like the old one.Is this possible with 2007 sharepoint and 2010 infopath?I'm sure it would require editing the CAML, but I just started in infopath and do not have any clue how to edit it.ThanksAnonymous
April 10, 2012
Hi EZ E,This has been asked a number of times...I know there are a lot of comments but if you go through them you will find complete steps for how to design the XSN so it does not use a repeating table. Do take note...one option you will find described will only work in the InfoPath client (and this is noted as such.) If you need one that works in the browser then you will need to use the code option documented in the comments...and it is complete with sample code.ScottAnonymous
April 11, 2012
The comment has been removedAnonymous
April 13, 2012
The comment has been removedAnonymous
April 15, 2012
Hi ScottI have come the solution a little closer.The code I use is the one used in the post on page 13, but posted 09:45 AM instead of 04:31 AMI was indeed using VB instead of C#.I figure how to change that under developer and then language.However I still get an error message, but this time its when I try to submit my preview. The error message looks like thisInfoPath cannot submit the form.The OnSubmitRequest event handler returned a value indicating that the submit failed.What can be the cause of that?I figured out how to change the names, but not like the example on page 8. I went back to sharepoint and renamed the colums, renamed labels in the xml file, modifyed the connection in my infopath file,saved and reopned, and Voilá, the names are looking good.Best regardsTroelsAnonymous
April 16, 2012
The comment has been removedAnonymous
April 16, 2012
The comment has been removedAnonymous
April 18, 2012
Hi Troels,Sounds like you may have missed something? The code still populates the "Add list item template" XML file and executes the "Web Service Submit" data connection. It is this connection that is tied to your list. Assuming you have this setup, make sure of the following:The "lists" web service that is used to submit the data must be referenced for the same level as the list you are trying to populate. For instance, if your list is here:http://server/subsite/Lists/ListNameThen the web service URL would be like this:http://server/subsite/_vti_bin/lists.asmxHowever, if your list is at the root level like this:http://server/Lists/ListNameThen the web service URL would look like this:http://server/_vti_bin/lists.asmxThere are a number of other issues that can cause data to not be sent to the list. Browse through all the comments and you will see a number of troubleshooting steps for these issues.ScottAnonymous
April 27, 2012
<a href="http://www.aengiascacascscaerinccascasgcaguideksdfjls.tv">age of empires guide</a>Anonymous
May 25, 2012
I got all the way to step 5 with InfoPath 2010 (somehow this 2007 link showed up for me atblogs.msdn.com/.../default.aspx) and was thrown for a loop, because I couldn't figure out how to "Open the Data Source Task Pane". Rather frustrating.Anonymous
June 02, 2012
I am very new to Sharepoint/Infopath. I have followed this post step by step. I have published the form to a Form Library. On click of new I can see the existing items. But on click of "Submit" I get an error message saying "An error occurred while form was being submitted". Please help me with this.Anonymous
June 04, 2012
I made a mistake in the Webservice selection for lists. Now I am able to submit and I also See the success message - but item is not being inserted in the List. Please help.Anonymous
June 07, 2012
nice article!!!!http://www.oxwebs.comAnonymous
June 11, 2012
Does this work with browser-compatible forms? I performed the steps documented and verified them several times. When I click the Submit button, I receive no error message, yet the new item is not added to the SharePoint list.Anonymous
June 11, 2012
Hi Dave,Yes - this works with browser forms. If you are using InfoPath and SharePoint 2007, go through the comments in this blog. I know there are a lot of them but many folks had the same experience and there are a number of reasons this can happen.If you have migrated to InfoPath 2010 and SharePoint 2010, then you no longer need to use this method. You can simply "customize" your list with InfoPath (this is an option on the Ribbon in the list), modify the form as you need and publish it back. Now, all the forms for the list will be your InfoPath form.ScottAnonymous
June 24, 2012
Hi Chulbul,Browse through the comments in this blog - there are a number of reasons why the items would not be added to the list and all of these are covered at various points in the comments.ScottAnonymous
June 27, 2012
Sorry, I have a silly question here... the screenshots in Step 6, is that done in SharePoint Designer or Infopath 2010?ThanksAnonymous
June 27, 2012
Hi BOM,InfoPath - and I believe, the 2007 version.ScottAnonymous
June 28, 2012
Hi Scott,Thanks for answering my question.I did all the steps in here and it worked well. Now I need to tweek some of the steps here for my own objective.Lets say i have more than 4 fields in the info form of different kinds - dropdown menus and check boxes. How do I edit the CAML code in Step 2? How can I put controls on the repeating table that's submitting data to the SharePoint list? In this example, all fields in the table are text fields. Can I make some of them drop down menus and checkboxes? Lastly, I only need to submit data to a sharepoint list. I dont want the data in my Shapoint list to get populated in the infopath. Can this be done? Any advise will be appreciated.Thanks again.Anonymous
June 28, 2012
Hi BOM,I know there are a lot of comments to this post but if you look through them, I provide complete steps for how to use other types of controls. I would encourage you to read through as much as possible on the other design options because depending on the design you choose, it may only work in the InfoPath application (versus a browser form.)ScottAnonymous
August 08, 2012
The comment has been removedAnonymous
August 08, 2012
The comment has been removedAnonymous
August 20, 2012
Hi Scott,Just to check if I saw this correctly. In Step 6-4."Double-click the “updates” parameter, select the “Add list Item Parameter” data source, select “Batch” and click OK" - Do you mean Add list Item Template?I don't think I created a data connection with that name.furthermore, when I submit my form, items are actually being added to the SP list. The only problem is that it's blank. Title is '(no title)' and other columns are empty. Would you happen to know where I got it wrong?Thanks in advance!Anonymous
August 20, 2012
Hi Essined,My apologies - yes, that should have been "Add List Item Template." But in short, you will use whatever connection you created for that XML file. In regard to why they are appearing blank - it sounds as if the values in your form are not being mapped back to the nodes in that XML file.ScottAnonymous
September 30, 2012
Her is the code I use{ // Write your code here. This is line 35 XmlNamespaceManager ns = this.NamespaceManager; //Create a DataSource object for the Add List Item Template data source DataSource dsAddListItem = this.DataSources["RecieveCompanyArchiveBatch"]; //Create an XPathNavigator object for that data source XPathNavigator xnAddListItem = dsAddListItem.CreateNavigator(); //Create an XPathNavigator object for the main DOM XPathNavigator xnDoc = this.MainDataSource.CreateNavigator(); //Create XPathNavigator objects for each of our fields in the main DOM XPathNavigator xnComName = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:ComName", ns); XPathNavigator xnComAddress = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:ComAddress", ns); XPathNavigator xnComPhone = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:ComPhone", ns); XPathNavigator xnComMail = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:ComMail", ns); XPathNavigator xnTitle = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:Title", ns); XPathNavigator xnPersonName = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:PersonName", ns); XPathNavigator xnPersonPhone = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:PersonPhone", ns); XPathNavigator xnPersonMail = xnDoc.SelectSingleNode("/my:myFields/my:Group1/my:PersonMail", ns); //Set the values of each field in the companyXML data source to the values from the main DOM xnAddListItem.SelectSingleNode("/Batch/Method/Field[1]",ns).SetValue(xnComName.Value) ; xnAddListItem.SelectSingleNode("/Batch/Method/Field[2]",ns).SetValue(xnComAddress.InnerXml); xnAddListItem.SelectSingleNode("/Batch/Method/Field[3]",ns).SetValue(xnComPhone.Value); xnAddListItem.SelectSingleNode("/Batch/Method/Field[4]",ns).SetValue(xnComMail.Value); xnAddListItem.SelectSingleNode("/Batch/Method/Field[5]", ns).SetValue(xnTitle.Value); xnAddListItem.SelectSingleNode("/Batch/Method/Field[6]", ns).SetValue(xnPersonName.Value); xnAddListItem.SelectSingleNode("/Batch/Method/Field[7]", ns).SetValue(xnPersonPhone.Value); xnAddListItem.SelectSingleNode("/Batch/Method/Field[8]", ns).SetValue(xnPersonMail.Value); //Submit the data this.DataConnections["WebServiceSubmit"].Execute(); }Anonymous
September 30, 2012
This comment is related to the code in the above comment.Hmm My first post dissipered my magic, so I will try again.When I try to submit I get the following error message:System.NullReferenceExceptionObject reference not set to an instance of an object. at CustomerArchive_ver2.FormCode.CTRL17_5_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)I have one section with 1 Rich textbox, 5 textboxes, and 2 comboboxes.The first combobox is populated from a sharepoint recieved connection(no filter), and the second one with the first combobox as a filter.The sharepoint list names, are the excact same ones as in the form, and the xml fil( checked for spelling errors etc.).Where have I made an error???TroelsAnonymous
October 04, 2012
Hi Troels,Unfortunately there is no way of telling from just your code. You will need to run the form in "debug" mode so you can step through it and see what object is null.ScottAnonymous
October 24, 2012
Is it possible to update a list from an Infopath form that is submitted to a document library? So you are adding data to the document library and to the lis.Anonymous
October 25, 2012
The comment has been removedAnonymous
October 28, 2012
The comment has been removedAnonymous
October 28, 2012
The comment has been removedAnonymous
October 28, 2012
Hi Heerachand,This has been covered a number of times in this blog. I know there are a lot of comments but take a look through them as you will find complete steps, sample code, etc. for doing exactly what you ask.ScottAnonymous
November 05, 2012
I found the answer to the /Batch question...Anonymous
November 06, 2012
The comment has been removedAnonymous
November 17, 2012
easy to see... about your tutorial... very clear step by step http://www.pembolang.comAnonymous
December 27, 2012
The comment has been removedAnonymous
January 02, 2013
Hi CLockeWork,Are you saying that you added a Repeating Table (or Section) to your Form Template and when you attempt to add a new row, that option is grayed out? If so, how did you design your Form Template? Did you start by launching InfoPath and choosing Blank Form or are you customizing a SharePoint list?ScottAnonymous
January 30, 2013
Hi Scott,Sorry for the slow response.When I right click on the repeating table in design and Repeating Table Properties the options for allowing users to add extra rows is dissabled. Is this down to the nature of the connection not allowing me to send multiple list entries at once?I created a new blank form through infopath.ThanksAnonymous
January 31, 2013
Hi ClockeWork,Can you try these steps for me:Launch InfoPath DesignerChoose the SharePoint List template type Enter your SharePoint URL and click Next Choose to create a new List...name it: ABCTest and click Next Enable the option: "Manage multiple list items with this form" and click Finish Right-click on the Repeating Section and choose Repeating Section properties Do you see the option: "Aloow users to insert and delete the sections" ?ScottAnonymous
February 14, 2013
The comment has been removedAnonymous
February 15, 2013
Gentlemen,I found your post extremely helpful in teaching myself to create forms which will update Sharepoint Lists. However, through no fault of your post, my forms failed to update the list. My server is forscom2.bliss.army.mil, so I am using a secured Sharepoint site. I followed all of the steps above exactly as typed and my form's submission was successful (meaning the infopath form responded that submission to the Sharepoint list was successful). However, the data from the form did not populate the list. What should I do?Anonymous
February 15, 2013
The comment has been removedAnonymous
February 17, 2013
Hi Nate,Your issue (and my reply :)) is the same as what I posted for CPT Ryan Rothschild - take a look through the comments. The "XPATH" expression (dfs:myFields) will not impact this process unless you are not referencing the correct XPATH from your form template. Most likely it is due to one of the known causes that I have mentioned in prior comments.ScottAnonymous
March 07, 2013
Thanks for your post. It works for simple text fields.BUT it does not work for User or Date type field.Anonymous
March 07, 2013
Hi Sangeet,Actually it does work for those field types and others as well - you just have to make sure they are formatted the way SharePoint needs to receive the data. I know there are a lot of comments on this post but if you read through the comments there are steps on how to do what you need.ScottAnonymous
March 14, 2013
The comment has been removedAnonymous
March 14, 2013
The comment has been removedAnonymous
May 21, 2013
The comment has been removedAnonymous
May 29, 2013
Select the “UpdateListItems” operationHow? How? How?Anonymous
May 31, 2013
Is there any way to only show the items the logged in user created on the current day?Anonymous
June 02, 2013
Hi DG2g1,If you are using InfoPath 2010 or later, you can actually use the "queryFields" to add a filter to the data connection so it will only return those items that have been entered for the current day.ScottAnonymous
June 03, 2013
Hi bronyx,On your SharePoint server, enable "Verbose" logging for InfoPath Forms Services. Then reproduce the error and check the ULS logs - you should get sufficient information to point you in the direction of the error.If you have a SharePoint farm that contains multiple web front ends, then chances are you are failing because of an authentication "hop" - meaning this: the InfoPath form was opened on Web Front End A - when the data connection was executed, it came back in through your load balancer which routed this request to Web Front End B - if that is the case, that is an NTLM authentication hop which is not allowed.But this is mere speculation until you get more details about the actual error.ScottAnonymous
June 03, 2013
Hi Confused and dismayed,If you did step 1 and clicked the Next button then you will see the list of operations available to you, one of which is UpdateListItems.ScottAnonymous
June 11, 2013
I tried but i am getting errorSome rules were not applied?Anonymous
June 11, 2013
Hi Zubair,That is not anywhere near enough information for me to provide any suggestions other than...the steps in the blog work. If you are having problems, start fresh and follow the steps exactly as I have them. If you still run into a problem then please provide more information other than you're getting an error.ScottAnonymous
July 10, 2013
The comment has been removedAnonymous
July 10, 2013
Hi Dominic,Yes - peruse all the comments as there are numerous entries about how to do this.ScottAnonymous
July 10, 2013
Haha thanks Scott, I didn't see that there was a more comments option.I've checked and now that I have found them all. I'm thinking there is no way of making this work for a content_type: Event, so that I can use a form to add to a Sharepoint Calendar. (even though this comes under lists)Anonymous
July 10, 2013
The comment has been removedAnonymous
July 10, 2013
The comment has been removedAnonymous
July 10, 2013
Hi Dominic,So if you are using the built-in Calendar columns, then the problem you are having is "Start Time" and "End Time" are NOT the actual underlying names for those columns - they are:EventDateEndDateI realize this is not obvious so to see all the actual names, you can do this:Create a new XSNAdd a Receive data connection to your calendar File the File tab, choose Publish and then click the Export Source Files button Export these to a local folder Open manifest.xsf with a text editor (i.e. Notepad - just make sure you do NOT allow Notepad to be the default application for opening this file) Scroll to the bottom and you will see the actual SharePoint names for all the columns I would also suggest you test this in "steps" - have your XML file only be for the "required" columns (Title, EventDate and EndDate) - once you have this working, then add others.ScottAnonymous
July 10, 2013
Thanks Scott, that's explained everything.Don't suppose you came across how to make it an all day event, using infopath?If not, no worries. Will try it out.Kind Regards,Anonymous
July 10, 2013
Hey Dominic - unfortunately I have not tried that. :(Anonymous
July 11, 2013
Found it.I looked at the sharepoint form source code and found the name as fAllDayEvent - Yes/No = 1/0So I plugged this is to my CAML:<Field Name="fAllDayEvent">1</Field>Thanks again for all the help.DomAnonymous
July 11, 2013
Hi Dominic,That's great to hear!ScottAnonymous
July 23, 2013
Hi Scott ,Thanks alot for the wonderful post , I have implemented this successfully. Here we are using InfoPath form for New form , How can have the same functionility for the Edit form in the list too? . If I customize the list using Infopath form , it ll have lot of limitations. Is this possible to extent this to edit form also?Thanks and Regards,Nandini PrasadAnonymous
July 28, 2013
Hi Nandini,This method is simply for taking data from an InfoPath form and adding/updating a SharePoint list. If you are using SharePoint 2010 and InfoPath 2010, then you can simply "customize" your form for a specific list using InfoPath. For example:Create a new custom listSelect the Ribbon for the list Click the "Customize form" button on the Ribbon This will launch InfoPath and you can customize the form, publish it back to that list and now your InfoPath form will be used for the Display, New and Edit forms.Note there are some limitations for this:You cannot add code behind a form that is for a listThe form will only submit to this one list. You may be able to add similar functionality to what this blog post describes but again, no code ScottAnonymous
August 04, 2013
Thanks alot for th reply Scott. yes I am using SharePoint 2010 , because of the limitations enforced by List customized using Infopath forms , I am looking at this approach. I am just able to design this form different rather than just inserting the secondary data repeating table as you have shown in the example. Is there any way we can redesign this form?Regards,NandiniAnonymous
August 04, 2013
Hi Nandini,You cannot take a standard InfoPath form and make it into a form used in a SharePoint list. So what you may be able to do is:For new entries: simply have a link on your SharePoint landing page that, when clicked on, will launch your form.For editing existing rows of list data: this is a bit trickier: you may be able to add a hyperlink column to the list that, when clicked on, will query for the record ID of that list item and return just that data to your form. This will be a bit challenging to implement but may work. (NOTE: I have not actually tested this - merely a suggested possibility.) ScottAnonymous
October 18, 2013
Hi,Are you able to use this form to update the information already in the list? Can you make changes in the display and when you hit the submit button it will submit the change to the list?Anonymous
October 18, 2013
Hi Ashley,Yes - with a few modifications. I know there are a lot of comments but if you go through them you will find sample steps on how to use the process to update existing list items.ScottAnonymous
October 21, 2013
Thanks Scott,I found your post from Oct 8, 2007 for writing the code. You said you added a new column with a button that would be used to update the row. Did you add this column after you already made the repeating table off of the MyContacts list? So will there be a button for each row? I need to be able to edit and delete the current items in the list.Right now I have a drop down that allows the user to select a value then the form displays the data from the sharepoint list for that value. Then I have the table where the user can add a new item and hit the button to submit the new item.Thanks!Anonymous
October 21, 2013
I actually think I figured that part out. The question I have is where does the code go for the public void? Is this vba or #C?Anonymous
October 23, 2013
The comment has been removedAnonymous
October 24, 2013
Great thanks Scott. This is the last question, sorry! I saw someone in an earlier post had the same problem but I get the error "the name 'e' does not exist in the current context". After researching it a bit it seems that the name needs to be declared before being called? Do you know how to fix this? The part of the code it pertains to is below:public void InternalStartup(){((ButtonEvent)EventManager.ControlEvents["UpdateList"]).Clicked += new ClickedEventHandler(UpdateList_Clicked("Update", e.Source.CreateNavigator()));}public void UpdateList_Clicked(string strOperation, XPathNavigator e){ //Create a new instance of our "Lists" web service ServerName.Lists myList = new ServerName.Lists();Anonymous
October 24, 2013
Ashley - please post all your code so I can see what you have.Thanks...Anonymous
October 24, 2013
public void InternalStartup(){((ButtonEvent)EventManager.ControlEvents["UpdateList"]).Clicked += new ClickedEventHandler(UpdateList_Clicked("Update", e.Source.CreateNavigator()));}public void UpdateList_Clicked(string strOperation, XPathNavigator e){ //Create a new instance of our "Lists" web service ServerName.Lists myList = new ServerName.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["Updated Headcount"]; //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create XPathNavigator objects for each field from our list XPathNavigator xnID = e.SelectSingleNode("@ID", ns); XPathNavigator xnTitle = e.SelectSingleNode("@Title", ns); XPathNavigator xnLastName = e.SelectSingleNode("@LastName ", ns); XPathNavigator xnFirstName = e.SelectSingleNode("@FirstName", ns); XPathNavigator xnFranchise = e.SelectSingleNode("@Franchise", ns); XPathNavigator xnLocation = e.SelectSingleNode("@Location", ns); XPathNavigator xnPillar = e.SelectSingleNode("@Pillar", ns); XPathNavigator xnLeader = e.SelectSingleNode("@Leader", ns); XPathNavigator xnActivity = e.SelectSingleNode("@Activity", ns); XPathNavigator xnCategory = e.SelectSingleNode("@Category", ns); XPathNavigator xnPosition = e.SelectSingleNode("@Position", ns); XPathNavigator xnDeptNumber = e.SelectSingleNode("@DeptNumber", ns); XPathNavigator xnSupervisor = e.SelectSingleNode("@Supervisor", ns); XPathNavigator xnEmployeeType = e.SelectSingleNode("@EmployeeType", ns); XPathNavigator xnFTE = e.SelectSingleNode("@FTE", ns); XPathNavigator xnNotes = e.SelectSingleNode("@Notes", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); //Create the CAML query passing in the value of each of our fields from the form if (strOperation == "Delete") { updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Delete'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "</Method>"); }Anonymous
October 24, 2013
The comment has been removedAnonymous
October 24, 2013
Thanks Ashley...so how are you getting that code into the "InternalStartup" procedure? Are you hand entering that? What happens if you:Go back to InfoPath DesignerRight-click on the button and choose Button Properties Click Edit Form Code What you have in InternalStartup does not seem correct.ScottAnonymous
October 24, 2013
Yeah that's what I did originally but I think I got confused as to where to put the UpdateList("Update",e.Source.CreateNavigator) versus the rest of the code. Now when I go to right click on the button and hit edit form code, it won't open.Anonymous
October 24, 2013
Ashley - delete what you have in InternalStartup then redo the steps from the button.ScottAnonymous
October 24, 2013
The comment has been removedAnonymous
October 24, 2013
Ashley,When you click the Edit Form Code button it takes you to the code and, by default, it will look like this:public void CTRL1_5_Clicked(object sender, ClickedEventArgs e){ // Write your code here.}** The name will probably not be CTRL1_5 but other than this, it should look like what is above.Where is shows "//Write your code here" - here is what you should have there:UpdateList("Update", e.Source.CreateNavigator());So now, the clicked event should look like this:public void CTRL1_5_Clicked(object sender, ClickedEventArgs e){ UpdateList("Update", e.Source.CreateNavigator());}Then just below the "closing brace" in the above procedure (the closing brace is the "}"), you need to have this entire procedure:public void UpdateList(string strOperation, XPathNavigator e){ //All the code from this procedure}ScottAnonymous
October 24, 2013
thank you! it was only an error with one of the names. There are no more errors when I debug the code but now when I try to make an edit in the repeating table I get the following error:Object reference not set to an instance of an object. at Updated_Headcount.FormCode.UpdateList(String strOperation, XPathNavigator e) at Updated_Headcount.FormCode.UpdateList_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)Anonymous
October 24, 2013
The comment has been removedAnonymous
October 24, 2013
Okay, thanks so much Scott for your help!Anonymous
October 27, 2013
Hi,Thanks for your post but need your help.I am just trying to submit data to sharepoint list using webservice like you suggested but i can new item added in sharepoint list but it is blank.Plz help me.Anonymous
October 27, 2013
Hi,Thanks for your post but need your help.I am just trying to submit data to sharepoint list using webservice like you suggested but i can new item added in sharepoint list but it is blank.Plz help me.Anonymous
November 07, 2013
Hello,What does the SharePoint list look like after the InfoPath Form is submitted? I would be nice to see a screen shot of how the table looks in the Columns of the list. Thanks.Anonymous
November 09, 2013
Hi,I am not able to attach any screenshot over here so if possible can me give me email address.My email id is kaushalbagrodia@yahoo.comAnonymous
November 16, 2013
HI,I am using your code on 15th page which can be used for non repeating fields. But its not working correctly.Is there anyway i can add non repeating field value to sharepoint list without using code.ThanxAnonymous
November 16, 2013
Hi Andy,Not sure I follow: the code can be modified to work with repeating or non-repeating fields. In addition, you can easily add data from non-repeating fields without using code... if I recall correctly, there are samples of this in the comments (it's been a while so I don't recall 100%) - but with a slight modification of the code (using an XpathNavigator object instead of an XpathNodeIterator object), it would work as well.ScottAnonymous
November 17, 2013
The comment has been removedAnonymous
November 17, 2013
The comment has been removedAnonymous
November 21, 2013
First of all thank you scott i learnt a lot from this post,But i am stuck at one place is that i want to add multiple rows of repeating table at one submit button click, Can you help me?Big Thanx in Advance.Anonymous
December 31, 2013
Actually, similar question as Scot on the multiple rows.I know that if I create my form in infopath and publish it as a template I could add custom code to handle creating a new node in the CAML xml. Then each row in a repeating table could be used to create a new update node.Still, I'd like to avoid having any attached code if at all possible.Anonymous
January 03, 2014
Bill F: the only way to add rows to a repeating structure is through code - this cannot be done via a Rule.Scot: adding multiple rows using code is not specific to what this we're doing in this post. Just search the Internet for how to add rows to an InfoPath repeating table using C# and you should get plenty of information. Then just incorporate that into this solution. I may have some of that type of sample code in the various comments on this post. Have you checked?ScottAnonymous
January 16, 2014
how to add multiple records into sharepoint list (multiple fields when user is given insert new item)Anonymous
January 16, 2014
Hi Nain,You have to use code to iterate over the rows in your repeating table. Take a look through the comments on this post - there is sample code to do this.ScottAnonymous
March 13, 2014
I get and error message when I attempt this.InfoPath cannot submit the form.An error occurred while the form was being submitted.The SOAP response indicates that an error occurred on the server:Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.<detail><errorstring xmlns="schemas.microsoft.com/.../"> List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. </errorstring><errorcode xmlns="schemas.microsoft.com/.../detail>Anonymous
March 13, 2014
Chris - when you add the data connection to the Lists web service, you have to add it at the appropriate level. Let me give you some examples:If your list is here: http://serverName/Lists/List1 then the URL to the web service will be: http://serverName/_vti_bin/lists.asmxIf your list is here: http://server/Site/Lists/List1 then the URL to the web service will be: http://server/Site/_vti_bin/lists.asmx You need to make sure your web service connection is pointing to the same site location as to where the list resides.ScottAnonymous
March 13, 2014
Hello Scott,BTW, thanks for assist me. If I understand this right you are referring to the GUID?Here is where the list resides:http://Server/ws/adm2/_layouts/listedit.aspx?List=%7BF85D231D%2D544C%2D4E78%2DAA41%2D6D1F70BE054E%7DI've translated the List to = {F85D231D-544C-4E78-AA41-6D1F70BE054E} and made the value of the ListName node to that. The ListName is located under MainI did notice that I name my Sharepoint List "My Contacts" instead of "MyContact", but I would think that mattersAnonymous
March 13, 2014
Hi Chris,What I am referring to is the web service connection you create to submit to the list. Based on the URL you provided, your web service connection URL should look like this:http://Server/ws/adm2/_vti_bin/lists.asmxI am referring to step 6 in the steps.ScottAnonymous
March 13, 2014
Ahhh..., that worked. Is there a way to apply to method to an existing infopath form that submits to a form library and capture certain field in the form to the Datasheet view of the library if that makes any sense?Anonymous
March 13, 2014
Hi Chris,Glad that worked for you. :) However, I am not clear on your next question - can you provide some additional details?Anonymous
March 13, 2014
No worries Scott, I answered my own question too late in the day my brain is about 30mins to shutdown.Anonymous
March 13, 2014
Well, Scott I do have one other question. Will this work on existing items in a list? For example I have a Employees List and as user fill of the form I was it to capture the address and update the Employee's information in the list like Address etc.Anonymous
March 13, 2014
Here is the CAML that im creating the Employees is Group/People picker field<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="New"> <Field Name='Employees'></Field>Home Address Street
<Field Name="Home Address City"></Field> <Field Name="Home Address State Or Province"></Field> <Field Name="Home Address Postal Code"></Field><Field Name="Home Address Street"></Field>
<Field Name="Manager's Name"></Field> </Method></Batch><Field Name="Mobile Number"></Field><Field Name="iPad Password"></Field><Field Name="iTunes Email Address"></Field><Field Name="iTunes Password"></Field><Field Name="Net Password"></Field><Field Name="Evolution Password"></Field>
Anonymous
March 13, 2014
Hi Chris,If you look through all the comments (I know there are a bunch) I have sample code for updating existing items in a list. The CAML "Cmd" needs to be changed to "Update" instead of "New" - "new" adds items to a list, "update" is what you use to update existing items. However, you also have to know the SharePoint ID of the item you want to update.Poke through the comments - you should find what you need.ScottAnonymous
March 13, 2014
Hello Scott,Is this the code you are referring too for updating an existing list? Just need to change varibles to match my columns. This is what consist in the CAML file?Then you need the "UpdateList" procedure as follows:public void UpdateList(string strOperation, XPathNavigator e) { //Create a new instance of our "Lists" web service sheimserver.Lists myList = new sheimserver.Lists(); //Pass the logged on users credentials to the web service myList.Credentials = System.Net.CredentialCache.DefaultCredentials; //Create a DataSource object for our list data source DataSource dsContacts = this.DataSources["MyContacts"]; //Create a NamespaceManager object so we can use the various namespaces on our XPATH expressions XmlNamespaceManager ns = this.NamespaceManager; //Create XPathNavigator objects for each field from our list XPathNavigator xnID = e.SelectSingleNode("@ID", ns); XPathNavigator xnFirstName = e.SelectSingleNode("@FirstName", ns); XPathNavigator xnLastName = e.SelectSingleNode("@LastName", ns); XPathNavigator xnTitle = e.SelectSingleNode("@Title", ns); XPathNavigator xnEmail = e.SelectSingleNode("@Email", ns); XPathNavigator xnPhone = e.SelectSingleNode("@Phone", ns); //Create a new XmlDocument to use for specifying the Update CAML query XmlDocument doc = new XmlDocument(); //Create the needed update element System.Xml.XmlElement updates = doc.CreateElement("Batch"); //Create the CAML query passing in the value of each of our fields from the form if (strOperation == "Delete") { updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Delete'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "</Method>"); } else { //Create the CAML query passing in the value of each of our fields from the form updates.InnerXml = string.Format(@"<Method ID='1' Cmd='Update'>" + "<Field Name='ID'>" + xnID.Value + "</Field>" + "<Field Name='FirstName'>" + xnFirstName.Value + "</Field>" + "<Field Name='LastName'>" + xnLastName.Value + "</Field>" + "<Field Name='Title'>" + xnTitle.Value + "</Field>" + "<Field Name='Phone'>" + xnPhone.Value + "</Field>" + "<Field Name='Email'>" + xnEmail.Value + "</Field>" + "</Method>"); } //Update the list XPathNavigator xnListGUID = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:ListName", ns); XmlNode node = myList.UpdateListItems(xnListGUID.Value, updates); //Requery the data source to reflect the updates dsContacts.QueryConnection.Execute(); }Anonymous
March 13, 2014
Hi Chris - yes...this code would need to match your field names and what you have in the CAML file. If you have trouble implementing this, I would encourage you to make a test list with exact names like this sample so you can see it work.ScottAnonymous
March 17, 2014
Hello Scott,Happy St.Patty's DaySo, I still need more direction on what I'm possibly missing or doing wrong. As suggested I've created a Sharepoint Test List. Below are my steps.Step 1.List called "Employee" with the following fieldsNameHome Address Street Home Address City Home Address State Or Province Home Address Potal Code Manager's Name Step 2.Secondly, I've created a new infoPath Filler Form and added the "Employee" List as a secondary data connection. Also, added the CAML file: "Add List Item Template" data connection.CAML File:<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="Update">
<Field Name="Home_Address_Street"></Field> <Field Name="Home_Address_City"></Field> <Field Name="Home_Address_State_Or_Province"></Field> <Field Name="Home_Address_Postal_Code"></Field><Field Name='Name'></Field>
</Method></Batch><Field Name="Mobile_Number"></Field><Field Name="Manager_s_Name"></Field>
Anonymous
March 17, 2014
Step 3.I created the "ListName" control with the GUID from the List Settings of the "Employee" List.Step 4.Created the Web Service Submit Data Connection http://Server/Site/_vti_bin/lists.asmx?WSDL, and selected "UpdateListItems." Pointed the tns:listName to the "ListName" control under myFields and pointed the tns:updates to /Batch under the Add List item Template.Step 5.Dragged and Dropped the below fields from "Employee" List to the form. Also, dragged and dropped "Name" and "Field" from Add List Item Template secondary data connection.Name Home Address Street Home Address City Home Address State Or Province Home Address Potal Code Manager's NameAnonymous
March 17, 2014
Step 6.Added a control button and set it to "Always Excutes" Rule with the following actions:Submit using a data connection: "Web Service Submit Batch"Query using a data connection: "Employee"I then applied the following code to the VB Code on the button, which generated 202ErrorsAnonymous
March 17, 2014
Scott,The code is too big to post I can send it via email. Here is my email address if it's ok with you to email me and I'll email you the code.chris_dixon22@hotmail.comAnonymous
March 17, 2014
Also, from another source I read that I have to create Web Service for each of the fields I would be updating.Therefore, I've created additional web service submit to each fields in the Employee List. They are setup similiar to the "Web Service Submit Batch." I set a action Submit data to the below data connections as well but i've since removed them for now."Web Service Submit Street""Web Service Submit City""Web Service Submit State""Web Service Submit Zip""Web Service Submit Manager"Anonymous
March 17, 2014
The comment has been removedAnonymous
March 17, 2014
Ok I give that a try momentarily. ThanksAnonymous
March 17, 2014
Hello Scott,I can see when I'm creating the receive data connection to the list that the fields with spaces have a underscore. I figured this would be a problem. I still will do as you suggested I just want to mention that.Example: Home Address Street = (Home_Address_Street)Anonymous
March 17, 2014
Ahhh..., no spacesin the manifest.xsf file shows like this<xsf:field internalName="Title" required="no" type="Text"></xsf:field> <xsf:field internalName="HomeAddressStreet" required="no" type="Text"></xsf:field> <xsf:field internalName="HomeAddressCity" required="no" type="Text"></xsf:field> <xsf:field internalName="HomeAddressStateOrProvince" required="no" type="Text"></xsf:field> <xsf:field internalName="HomeAddressPostalCode" required="no" type="Text"></xsf:field> <xsf:field internalName="ManagersName" required="no" type="Text"></xsf:field> <xsf:field internalName="ID" required="no" type="Counter"></xsf:field>
Anonymous
March 17, 2014
Ok, so I changed the CAML file to match the fields. I'm in the code edior notw for te Submit button. See Below , I have not added any coding yet. Where would the code go? Underneah the Namespace pdateListTest Or under Pulic Sub CTRL10_5_Clicked.....Namespace UpdateListTest Public Class FormCode ' Member variables are not supported in browser-enabled forms. ' Instead, write and read these values from the FormState ' dictionary using code such as the following: ' ' Private Property _memberVariable() As Object ' Get ' _memberVariable = FormState("_memberVariable") ' End Get ' Set ' FormState("_memberVariable") = value ' End Set ' End Property ' NOTE: The following procedure is required by Microsoft InfoPath. ' It can be modified using Microsoft InfoPath. Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup AddHandler DirectCast(EventManager.ControlEvents("CTRL10_5"), ButtonEvent).Clicked, AddressOf CTRL10_5_Clicked End Sub Public Sub CTRL10_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs) End Sub End ClassEnd NamespaceAnonymous
March 17, 2014
Chris - the ability to successfully get this to work requires some coding knowledge - without that, you're really jumping into the 10' end of the pool without knowing how to swim.The code project you have looks like VB and I believe my code samples are C# (if I recall correctly.) If this is the case, you will need to use the InfoPath UI to remove the current code project and add a new one for C#. Then the code I provided will go into the button click event.ScottAnonymous
March 17, 2014
Yes, I have some programming knowledge the Infopath was set to VB as default I just changed it to C# and here is what I get on the Submit button now.using Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace UpdateListTest{ public partial class FormCode { // Member variables are not supported in browser-enabled forms. // Instead, write and read these values from the FormState // dictionary using code such as the following: // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // NOTE: The following procedure is required by Microsoft InfoPath. // It can be modified using Microsoft InfoPath. public void InternalStartup() { } }}Anonymous
March 17, 2014
Hey Chris - that's good to hear. The code project now looks good. :) I would add your own button (at least for testing purposes) and use the sample code in this post on the click event of the button.ScottAnonymous
March 17, 2014
Ok, Scott I think I'm close get 1 errorError 1 Type 'UpdateListTest.FormCode' already defines a member called 'InternalStartup' with the same parameter types \serverpathpathmeInfoPath ProjectsUpdateListTest1FormCode.Designer.cs 29 21 UpdateListTestWhen I click the Error it takes me to the FormCode.cs tab and highlightsusing Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace UpdateListTest{ public partial class FormCode { // Member variables are not supported in browser-enabled forms. // Instead, write and read these values from the FormState // dictionary using code such as the following: // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // NOTE: The following procedure is required by Microsoft InfoPath. // It can be modified using Microsoft InfoPath. public void InternalStartup() { } }}Anonymous
March 17, 2014
Hey Chris - sounds like you have two "InternalStartup" methods defined? Maybe from a copy/paste scenario?ScottAnonymous
April 18, 2014
I have a very similar situation as reported (and solved) by many of the other users in this blog. I followed the instructions exactly as described however, I am showing a successful submit from the InfoPath Filler, but no entries in my sharepoint custom list.Triple checked the GUIDThe URL for web services is pointing to the Team site (not the main server) There are no warnings or errors in my Application Event logs I have the 'Title' field in my Sharepoint, CAML and Infopath What am I missing??Anonymous
May 14, 2014
Can we use this approach for updating external list(BCS). I am able to update SharePoint custom lists but not the external list. Do you have any thoughts ?ThanksMahiAnonymous
June 12, 2014
Hello Scott,I'm hoping you can help me again. I have a current form that submits to a Sharepoint List with a calendar view. The customer now wants the ability to have the form create weekly recurring meetings on the calendar. Therefore, I've created the following fields1.Repeat Every __ Week(s) On -Text Field (__)2.A checkbox for each day of the week M-F3.Start date - Date Picker field4.End Date- Date Picker field5.Start Time6.End TimeI created the ListName/GUID but not the CAML file yet because I'm unsure how to code that correctly.Thanks, In advance for your help and direction on thisChrisAnonymous
June 17, 2014
Hello. I am able to successfully follow these instructions till 4. Double-click the “updates” parameter, select the “Add list Item Parameter” data source, select “Batch” and click OK in Step 6: Add the “lists.asmx” web service.Batch is not an option.Any help / suggestions would be appreciated.Anonymous
July 02, 2014
Hello Scott, Is there a possiblity to submit the data along with attachment as well in this method? I want to create a list item with attachment in this way of submitting. Please let me know. ThanksAnonymous
July 02, 2014
Sorry for the delay everyone...@Mahi: I honestly have never tried this and since an external list is based on the schema of, say, a SQL Server table I don't know if this process would work. If I get some time, I'll try and test this at some point.@Chris: I'll have to investigate this if I get some time.@Mgauf: The "batch" node comes from your "Add List Item Template" data connection. If you have selected that connection and you don't see the "batch" node then the XML file is not constructed correctly.@Chandru: Did a little testing with this and the only way I can see this working is with code. The reason is this: from the "Lists" web service there is an "AddAttachment" web method that can be easily called to create an attachment to a specified list item. The issue is one of the parameters is the attachment but as "base64Binary" not "base64String" which is how an attachment in InfoPath is stored. The only way I can think of to convert a base64String to base64Binary is using code.ScottAnonymous
August 25, 2014
The comment has been removedAnonymous
August 29, 2014
This is completely unclear. You cannot add data connections to an xml file or a sharepoint list.Add a “Receive” type secondary data connection to the Add List Item Template.xml file created in Step #2. (Make sure the options “Include the data as a resource file in the form template” and “Automatically retrieve data when the form is opened” are enabled.) Add a “Receive” type secondary data connection to the “MyContacts” SharePoint List created in Step #1 and make sure the option “Automatically retrieve data when the form is opened” is enabled.Anonymous
August 29, 2014
Hi Valerie,Not sure I am following: from within InfoPath you can add data connections to XML files and SharePoint lists. Can you provide some additional detail around where you are not able to do this?Thanks,ScottAnonymous
September 04, 2014
Hi Scott - fantastic article - its really helped me add more functionality to my forms - Thank you!I notice this is an old post and I am hoping there have been some developments since this was originally posted. Like some of the other people that have posted here I am looking for a way in which to initiate a task in a separate list - without having to load that task list form. As pointed out by a few others the repeating table tied to CAML is quite lkimited when you want to add different controls. In particular the people picker control when you want to initiate a task in another list and fill out the Assigned To person. Have there been any developments or other methods found that will allow for this functionality?Again, many thanks for such an informative article.WarrenAnonymous
September 12, 2014
Hi Warren,Since this post was originally written, Microsoft has shipped Office/InfoPath versions 2010 and 2013. With these later versions you can create InfoPath forms directly against SharePoint lists. Those forms will be tied to the specific list and since managed code is not available with an InfoPath "list" form, the advanced steps in this particular post will not be of benefit.You can still use the information in this post if you create a standard InfoPath Form Template (i.e. not tied to a list) but the functionality of how you would add items to a list from a standard form has not changed.If you were to peruse the comments in this post there is the ability to use other types of controls; however, there is still not a way to place a "people picker" control on an InfoPath form and populate a "Person/Group" column in SharePoint - at least not directly. :) What you can do is promote the "AccountId" node from the InfoPath form and then use a SharePoint Designer workflow to copy that value to the Person/Group column in your SharePoint list/library.I hope this information helps!ScottAnonymous
September 24, 2014
Does anyone know how to apply this method to delete a list item? I am using the advanced custom method with the CAML file. My code looks like this:<?xml version="1.0" encoding="UTF-8"?><Batch OnError="Continue"> <Method ID="1" Cmd="Delete">
</Method></Batch>i Then set the field to equal the ID of the list item.I get the error that the Paramater is incorrect.Any Ideas?<Field Name="ID"></Field>
Anonymous
October 12, 2014
Hello Scott HeimI have tried this on my sample form and it works fine, no issues at all.However, what could I do if I wanted to pass some default values to some of my fields like if I wanted to pass a value say now() to my "Title" field - would it be possible to pass. I have been struggling to do this but to no avail. Can you please help.AmarAnonymous
December 04, 2014
The comment has been removedAnonymous
December 04, 2014
@Hadden: This is the exact CAML I have in my "delete" template and it works fine when I set the ID field to the ID value I want to delete:<Batch OnError="Continue"> <Method ID="1" Cmd="Delete"> <Field Name='ID'></Field> </Method></Batch>@Amar: If you are trying to set a default value using the exact steps documented in this blog post, then it won't work. Go through the comments in this post (yes, I know there are a lot) and you will see other ways to design the form template and this is what you will need to do.@Dushi: I just tested the following:Created nested subsites with my list at level 6 like this:https://MyTestSite/sites/Test/subsite1/subsite2/subsite3/subsite4/subsite5/subsite6/lists/MyListCreated my web service data connection like this:https://MyTestSite/sites/Test/subsite1/subsite2/subsite3/subsite4/subsite5/subsite6/_vti_bin/lists.asmxThis connected without issue and I was able to successfully submit to my list called "MyList"ScottAnonymous
December 09, 2014
Scott,Thank you so much for the reply. I think I figured out what I was doing wrong the first time. It appears the fields in my list get a very strange name, for example:"Full_x0020_Name""Rate_x002f_Rank""Date_x0020_Completed"I had to adjust accordingly in my CAML and now it works.Now, for me, I deleted the first repeating table (i.e. the table that shows all of the data that is already in the list. That leaves me with one repeating table, which is the table with the list field names on the left (derived from the CAML) and the user input for those fields on the right. One question I have now is:The fields on the left display the exact names from the CAML, is there any way to change that? I tried messing with the CAML a bit, but wasn't able to figure much of anything out.I have a few more questions:The CAML is local to my computer. If I send this to someone on the other side of the world or even, to someone on the other side of the room, is it still going to work?Similarly, if I open this in InfoPath Filler (vice Designer), it tells me that the forms template is on my local computer - how do I change it so the template is on a centralized location (i.e. the sharepoint)? Should I just upload the template to my sharepoint and then open that template file with Filler and save it as the .XML? I think that may be all of the questions I have. Thank you so much again for replying.-DushiAnonymous
December 09, 2014
Hi DushiPunda,I am glad you were able to get the process working. Regarding the "strange name" scenario, this is expected from SharePoint as it has to encode certain characters. As an example, "_x0020" is an encoded space.Regarding your additional questions:1) The CAML is local to my computer. If I send this to someone on the other side of the world or even, to someone on the other side of the room, is it still going to work? > When you follow the steps in this post, that CAML file is embedded as a "Resource file" in the XSN. (You can see this by opening the XSN in Design View, selecting the Data tab and then clicking "Resource files" in the Ribbon.) So yes - when you publish or send this XSN to other users, the CAML file goes with the XSN.2) Similarly, if I open this in InfoPath Filler (vice Designer), it tells me that the forms template is on my local computer - how do I change it so the template is on a centralized location (i.e. the sharepoint)? Should I just upload the template to my sharepoint and then open that template file with Filler and save it as the .XML? > No - you need to "publish" the XSN to your SharePoint site. See this link for more information:support.office.com/.../Publish-a-form-bd6eb030-b26b-4774-b22b-7c80e0089403ScottAnonymous
December 16, 2014
Hi Scott,A great article, am I assuming that you can use the same technique to update/delete from the list too, I appreciate that I'd need some more CAML xml queries.Is this possible without code and I would like to do this in IP2010 and MOSS 2007.I have followed your article with success :)Regards,Anonymous
February 03, 2015
Hello, we are working in SP 2013 now - and trying to implement a variation of this technique for submitting to a SP list via Web Service. The difference is that we have a Parent-Child(ren) or Header-Detail relationship and we want to use the technique here to submit to the Child list. It all seems to go smoothly until we actually click 'Save <Detail Entity>' and we get the dreaded 5567 error and off I go to the Error Logs. There I find a 500 error. So it looks as if I am able to hit the service but then am having issues.Before I elaborate, let me know if anyone is listening and able or willing to help...thx.Anonymous
February 11, 2015
Dmawer,Change the cmd="New" to cmd="update" you will need to carry the ID with you as well as the other fields.John Marno,I am having the same error, but only when i try to use the method on a Browser form. No issues with the client form.Does anyone know a trick to get it to work on the browser forms?Anonymous
March 13, 2015
Hi I get this error. Any Body Know why?The form cannot be submitted because of an error.Click OK to resume filling out the form. You may want to check your form data for errors.Hide error detailsAn error occurred while using the form. For more information, contact the site administrator.An entry has been added to the Windows event log of the server.Log ID:5567Anonymous
March 13, 2015
Hi I get This error on submit the form.Any Body Know why?The form cannot be submitted because of an error.Click OK to resume filling out the form. You may want to check your form data for errors.Hide error detailsAn error occurred while using the form. For more information, contact the site administrator.An entry has been added to the Windows event log of the server.Log ID:5567Anonymous
March 20, 2015
When I submit from InfoPath filler then it work like charm but after publishing on SharePoint if I try to submit then it says "Sending data to the server... "but nothing happens after this..Anonymous
June 16, 2015
Same as Kamalpreet Singh, I copied this and it works a charm in filler but throws error in browser. I am using IP2010, SP2013 implemented in cloud so no access to error logs. Anyone got any ideas?Anonymous
June 25, 2015
My question would be, once you fill out the form and submit it, and repeating data is sent to the list can you update the "form" and hit submit again without having it create duplicate items?Anonymous
June 29, 2015
@Kamalpreet and @Guy: if you are trying to use this in an Office 365/SharePoint Online site, it will not work as InfoPath is unable to call the necessary SharePoint web services from a browser form. This is due to the security needs in O365 and the fact we are unable to disable the Loopback check. @Spassler: If you simply use the same "Add list item template" to submit the data again, it will be added again. You will have to implement logic to "update" those that already exist and "add" those that are new. ScottAnonymous
July 22, 2015
I followed the steps except for adding the Submit web service in lists.asmx, I don't see how to add this in lists.asmx, after hitting Submit button, message is "The form is successfully submitted", however my SharePoint list doesn't have the data that I have entered in my Template form. Should I let our web group to add the Submit in the lists.asmx? Please helpAnonymous
July 22, 2015
Hi Maria, You don't add the submit web service connection "in" lists but you add it in your InfoPath Form Template "to" the lists.asmx web service. Take a look at the steps again and keep in mind, you need to add this to the lists.asmx web service at the same level your list resides. So as an example:
- If your list location is like this: http://YourSharePointSite/Lists/MyList Then the URL for the lists web service would be: http://YourSharePointSite/_vti_bin/lists.asmx
- If your list location is like this: http://YourSharePointSite/YourSubsite/Lists/MyList Then the URL for the lists web service would be: http://YourSharePointSite/YourSubsite/_vti_bin/lists.asmx
- If your list location is like this: http://YourSharePointSite/sites/SomeSite/Lists/MyList Then the URL for the lists web service would be: http://YourSharePointSite/sites/SomeSite/_vti_bin/lists.asmx NOTE: It is important to know the process documented in this blog post will not work with Office 365 - this will only work with your On Premise SharePoint server. Scott
Anonymous
July 31, 2015
Same issue as the rest. When I submit, I don't see any error messages, but the new list item is never added.Anonymous
September 09, 2015
The comment has been removedAnonymous
September 27, 2015
New to Infopath. This article is still solid and relevantAnonymous
October 01, 2015
All, I found a way (at last) to populate the Batch CAML Fields via rules rather than having to type them in! After dragging the Batch connection onto your form, add rules to e.g. a button to update the Batch/Method/Field value. When you run the form the rule populates ALL the Fields, BUT if you publish as source files, find the rule in the manifest (this one updates the Field to 99) : e.g.<xsf:assignmentAction targetField="xdXDocument:GetDOM("caml")/Batch/Method/Field" expression=""99""></xsf:assignmentAction> and add a filter to the Field: Field[@Name="ID"] Save and design the Manifest file in IP and the rule now works. Do the same for the other rules, targeting the correct Name.Anonymous
October 01, 2015
Further to my last post, the Field filter I posted had "s which show as quotation marks in my post. The filter needs to be Field[@Name=&qu0t;ID& qu0t;], (I've substituted 0s rather than Os here so it doesn't get shown as " again.) Hope that isn't too confusing. BTW my solution was for updating an O365 list item.Anonymous
October 30, 2015
Scott, Thank you for this information. I hope that it will work for me.Anonymous
November 02, 2015
The comment has been removed