Hello SO:
I am working with sharepoint and I am trying to add a service call to microsoft's call center application template. I can add one with just a name with the following code:
SPSite allSites = new SPSite(siteURL);
SPWeb site = allSites.AllWebs[siteName];
SPListItemCollection requestsList = site.Lists[serviceRequests].Items;
SPListItemCollection customerList = site.Lists[customers].Items;
SPListItem item = requestsList.Add();
item["Service Request"] = "Program Test";
//item["Customer"] = "Donald Duck";
item["Customer"] = customerList[0];
item.Update();
First I tried just using the customer name, which did not work. I then got the customer list and tried to use the customer list item instead, but I still get the same error:
"Invalid data has been used to update the list item. The field you are trying to update may be read only."
Does anyone have experience with adding information to sharepoint from code similar to this? Is there someway I can determine which fields are read-only, if any?
Thanks!