【问题标题】:Programmatically adding a service call to SharePoint Call Center application以编程方式将服务调用添加到 SharePoint 呼叫中心应用程序
【发布时间】:2009-08-18 00:42:47
【问题描述】:

我正在使用 sharepoint,并且正在尝试将服务调用添加到 Microsoft 的呼叫中心应用程序模板。我可以使用以下代码添加一个名称:

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();

首先我尝试只使用客户名称,但没有成功。然后我得到了客户列表并尝试使用客户列表项,但我仍然得到同样的错误:

"Invalid data has been used to update the list item. The field you are trying to update may be read only."

有没有人有从类似的代码向共享点添加信息的经验?有没有办法确定哪些字段是只读的(如果有的话)?

谢谢!

【问题讨论】:

    标签: c# sharepoint


    【解决方案1】:

    我找到了解决这个问题的方法,请check out this link

    【讨论】:

    • 您不需要走那么远就能完成这项工作。将 Index 值设置为 Lookup 字段而不是 1#Value 格式就足够了。
    【解决方案2】:

    当您有一个查找字段并且您没有为其指定值时,有时会发生这种情况。例如,当您有一个包含以下项目的列表时

    1. 客户:文本
    2. 部门:部门列表的查找和必需的。

      SPListItem item = requestsList.Add();        
      item["Customer"] = "as";
      item.Update();
      

    现在你会得到这个错误。因为你没有指定部门字段的值

    【讨论】:

      猜你喜欢
      • 2018-03-28
      • 1970-01-01
      • 2018-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多