Updating a SharePoint list item from form - InfoPath Dev
in

InfoPath Dev

Updating a SharePoint list item from form

Last post 10-14-2011 01:33 AM by Mingle. 24 replies.
Page 1 of 2 (25 items) 1 2 Next >
Sort Posts: Previous Next
  • 07-20-2006 06:38 AM

    Updating a SharePoint list item from form

    I have a form that will be published to a SahrePoint Forms Library. One of the fields will be a sequential ticket number. I need to maintain this number somewhere and figured it might be easy just to create a SharePoint list with 1 item in it, a ticket number, and then each time a new form is creaed it would read the existing number, increment it by one and then update the number in the SharePoint list. Is this even posible? If so, how?
    Thanks for any help.
    Mike
  • 07-20-2006 06:47 AM In reply to

    Re: Updating a SharePoint list item from form

    Hi,

    Check out this link,

    http://infopathdev.com/forums/topic.asp?TOPIC_ID=2157

    I hope this will help for you,
    Thanks.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 07-20-2006 06:53 AM In reply to

    Re: Updating a SharePoint list item from form

    Hey thanks for the info. I was really hoping that I could do this within the forms rules as opposed to custom code but it doesn't look that way.
    I am using the new Sharepoint and Infopath 2007...do you know if that is built in functionality in these versions?
  • 07-20-2006 07:16 AM In reply to

    Re: Updating a SharePoint list item from form

    Mike,
    This is possible. I am receiving and submitting "update" data to SharePoint lists currently.

    However when i was searching last week there is lots of samples for creating CAML templates for new records but very little on modifying existing records in the lists.

    http://www.codecomments.com/archive355-2005-10-652981.html
    Here is a link that helped me.

    Obviously I think you are familiar with getting the data from SharePoint. I usually use a spreadsheet import to create the initial list.

    If you follow the instruction on setting up a CAML template.
    http://www.infopathdev.com/howto/tutorials/default.aspx?i=7bc880f391b84ea9b3b45c6fbecc07c6

    The main difference is using the Update command instead of the new or delete. (Cmd="Update")
    The other key for this is you need to include the ID field from the SharePoint list on the receive connection as this is the reference to identify the records to be updated.

    Here is a sample CAML template for updating a contact list.

    <?xml version="1.0" encoding="UTF-8" ?>
    - <Batch OnError="Continue">
    - <Method ID="1" Cmd="Update">
    <Field Name="ID" />
    <Field Name="Title" />
    <Field Name="FirstName" />
    <Field Name="Email" />
    <Field Name="WorkPhone" />
    </Method>
    </Batch>

    Then as you display records and make changes you submit and the changed values are written to their corresponding records.

    I have found syntax very sensitive in these templates so be careful with capitalization.

    As far as i know this is the same for 2007 as it was for 2003. I have used this method successfully on both.

    Hope this helps.
    Clay
  • 07-20-2006 07:21 AM In reply to

    Re: Updating a SharePoint list item from form

    Hey Clay...thanks for this. I am very new to InfoPath/Sharepoint and especially coding. All I need to do is update a list that contains 1 item. A number. It will be using to maintain a sequential ticket number. I loveed building the InfoPath template and working with all the rules, but when it came to this I was at a lose.
  • 07-20-2006 07:22 AM In reply to

    Re: Updating a SharePoint list item from form

    I forgot to address your specific need with the counter.

    I would receive the data from the SP list in the method above, with the ID field. increment the value and overwrite the value and submit back to SP. You would want to do this on open of the form probably, the quicker the better. Otherwise if their are multiple forms open at once, the longer you wait the more likely hood for duplicate numbering.

    Clay
  • 07-20-2006 11:14 AM In reply to

    Re: Updating a SharePoint list item from form

    Ok...I have mae some progress and followed the steps provided but I have one issue. I went in to get the list guid by selecting the list and going to Edit in Datasheet. I had this url:
    http://davsdv1:28394/sites/myvoice/Lists/TicketNum/AllItems.aspx?ShowInGrid=True&View=%7B0A3C5AE3%2D0323%2D4478%2DB257%2DC88381B0612D%7D
    I converted the guid to: B0A3C5AE3-0323-4478-B257-DC88381B0612D

    And this is what I used. When I entered it in the web service submit, I get an erro stating the list doesnt exist. I beleive it is because I did not have the correct guid. I do have sharepoint 2007 and it seems to be different than the previous version. i.e. when in a list I cannt choose Modify Settings and Columns which is what another post suggested to get the list guid.
    Anyone know how to get the guid in sharepoint 2007? Thanks
    Mike
  • 07-20-2006 11:53 AM In reply to

    Re: Updating a SharePoint list item from form

    Oh...here is the error I get from the submit function:

    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/">
    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.
    </errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail>
  • 07-20-2006 01:35 PM In reply to

    Re: Updating a SharePoint list item from form

    Yah it would help if you had the rights to modify the list.

    I just looked at a list I update and in DataView it shows a different ID. Maybe someone else can elaborate why that is but I would extrapolate that to confirm that the ID you are using is incorrect.

    Do you have a my site or area where you have admin right to test a list?

    Or have an admin get that ID for you.

  • 07-21-2006 04:57 AM In reply to

    Re: Updating a SharePoint list item from form

    Actualyl I a doing this in a dev environment and have admin right to the site. Plus, I dont want to give everyone admin rights to the list that need to use the form so maybe this wont work for me if admin right are required to update a list.
  • 07-21-2006 11:28 AM In reply to

    Re: Updating a SharePoint list item from form

    They are not required admin rights. You just need to go into Modify Settings and Columns, which is at the bottom of the quick launch bar on the left or in 2007 use the Settings drop down and then go to list settings. Then get the List ID from the URL. this is what the Admin rights are for. Nothing else is different from a Form/User permissions perspective.
  • 07-21-2006 12:03 PM In reply to

    Re: Updating a SharePoint list item from form

    Thanks for the clarification. I did get the guid and set thinks up as the links above suggested. However, for some reason I still get the List does not exist message. Not sure where the issue is at this point.
  • 07-21-2006 01:04 PM In reply to

    Re: Updating a SharePoint list item from form

    You could post the eror message. Also maybe a copy of your CAML and the syntax of your GUID.
  • 07-21-2006 01:14 PM In reply to

    Re: Updating a SharePoint list item from form

    I sure can:

    The list is called TicketNum and has one column called Number with only one entry in it.

    The CAML file is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Batch OnError="Continue">
    <Method ID="1" Cmd="Update">
    <Field Name="Number" />
    </Method>
    </Batch>

    The list guid is: D3F99604-6241-4781-ADD3-7AE00ADA85BD

    I have the form set up so when you click a button it will submit the ticket number field to the list web service calling UpdateListItems.

    The error I get when I click the button is:
    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/">
    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.
    </errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail>


    Thank you for any assistance you can provide.

    mike
  • 07-24-2006 07:02 AM In reply to

    Re: Updating a SharePoint list item from form

    I noticed you do not have your GUID in {}. I just tried removing brackets in my form and I got the exact same error you have listed here. This is in 2003 but looking at my 2007 example I have brackets on it as well. I put my GUID in as the Default Value. I am not sure how you are doing it but that could maybe cause an issue when setting a value or transfering it.

    Let me know if that is it.
Page 1 of 2 (25 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.