Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The trick to working with a List is to get the Web Service Location correct, the URL in the referenced web Service set to the correct location, and use the names of the fields as they are defined in the List.</p> <pre><code> private void ReadTaskandAddtask() { try { tcfifsharepoint.Lists listServiceBase = new tcfifsharepoint.Lists(); // SharePoint Web Serices require authentication listServiceBase.Credentials = System.Net.CredentialCache.DefaultCredentials; listServiceBase.Url = "http://SPServer/Site/_vti_Bin/lists.asmx"; String newIssueTitle = "Programmatically added issue 3"; String listGUID = "FC519894-509A-4B66-861E-2813DDE14F46"; String activeItemViewGUID = "C93FFC02-368B-4D06-A8AE-3A3BA52F4F0C"; listGUID = "{FC519894-509A-4B66-861E-2813DDE14F46}"; activeItemViewGUID = "{DCF35B63-F85C-463B-B1A1-716B4CF705C5}"; // first check if item is already in the list XmlNode activeItemData = listServiceBase.GetListItems(listGUID, activeItemViewGUID, null, null, "", null, ""); if (!activeItemData.InnerXml.Contains(newIssueTitle)) { //*********************This is Working ********************************* StringBuilder sb_method = new StringBuilder(); sb_method.Append("&lt;Method ID=\"1\" Cmd=\"New\"&gt;"); sb_method.Append("&lt;Field Name=\"Title\"&gt;Some Title 14&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"AssignedTo\"&gt;Name to assign&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"Status\"&gt;In Progress&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"Priority\"&gt;(3) Low&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"DueDate\"&gt;"); sb_method.Append(DateTime.Parse(DateTime.Now.ToString()).ToString("yyyy-MM-ddTHH:mm:ssZ")); sb_method.Append("&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"PercentComplete\"&gt;.34&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"Body\"&gt;Something entered into the description field.&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"Author\"&gt;Your Author&lt;/Field&gt;"); sb_method.Append("&lt;Field Name=\"Editor\"&gt;This is Modified By&lt;/Field&gt;"); sb_method.Append("&lt;/Method&gt;"); XmlDocument x_doc = new XmlDocument(); XmlElement xe_batch = x_doc.CreateElement("Batch"); xe_batch.SetAttribute("OnError", "Return"); xe_batch.InnerXml = sb_method.ToString(); XmlNode xn_return = listServiceBase.UpdateListItems("Task List Name", xe_batch); } catch (Exception e) { string sMessage = e.Message; } } </code></pre> <p>You can see the internal names used for the list items(Columns) in the SharePoint list by selecting the "Settings" pull down and selecting the "List Settings" Item. Once in the List Settings click on a column and then look at the URL to see the "Field=Name". That is the name you need to be using when you create your fields.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload