我已经编写了代码,使用服务器端代码设置BCS在Sharepoint 2013中公开的外部数据。这是代码:
public void SetBusinessDataValue(object spItem,object spField, string value)
{
try
{
SPBusinessDataField businessDataField = spField as SPBusinessDataField;
SPListItem spListItem = spItem as SPListItem;
businessDataField.ParseAndSetValue(spListItem, value); //Set your value here
string fieldName = ((SPField)spField).Title;
spListItem[businessDataField.RelatedField] = spListItem.Fields[fieldName];
}
catch (Exception ex)
{
Logging.LogWriteLine("Error in method SetBusinessDataValue(). Failed to set the business data value", ex);
}
}
它运行良好。但是,我无法编写代码来使用SharePoint客户端对象模型在SharePoint 2013 Online中设置外部数据。有人能帮我解决问题吗?
您正在使用沙箱解决方案吗?如果是,您可以在沙箱解决方案中编写相同的服务器代码。请试试看。