3

I want to add new item to SharePoint list using web service. I use SharePoint 2013. I found on the net follow code, but I don't understand how to use?

<Batch OnError="Continue">
<Method ID="1" Cmd="New">
    <Field Name="Title">Abcdef</Field>
    <Field Name="Project_x0020_code">999050</Field>
    <Field Name="Status">Open</Field>    
</Method>

Where I write this code, where I publish? Is there any other way?

Source of the code: SharePoint - How do insert new items using the list web service?

1

Try using below code by passing ViewName,

<Batch OnError="Continue" ViewName="{D0E978D3-4D39-4CBE-ACEC-BCFB22344252}">
    <Method ID='1' Cmd='New'>
        <Field Name='Title'>The New Task Title</Field>
     </Method>
</Batch>

In another way we can create Web Site Project in Visual studio to illustrate. For that click on Add Web Reference and give the URL to the Web Service,

Its Demonstrated here,

http://sarangasl.blogspot.in/2009/12/sharepoint-list-web-service.html

http://sarangasl.blogspot.in/2009/12/addupdate-list-item-using-sharepoint.html

| improve this answer | |
  • "Where I write this code, where I publish? Is there any other way?" is the question here – Robert Lindgren Nov 9 '15 at 8:23
  • Yes, where I write this code, where I running this code? In a VS SharePoint Project, or xml file? I don't know this – zengel Nov 9 '15 at 8:27
  • Yes yes I got to know about your question, here is the link that provides information about it hope this helps, "c-sharpcorner.com/Blogs/7655/…" – Niranjan Kulkarni Nov 9 '15 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.