【发布时间】:2017-08-09 14:29:40
【问题描述】:
我有一个员工列表,其中有 2 列(部门和经理),它们是查找列。当新用户注册时,我需要代码来更新这些查找列。 (虽然列表中的其他列正在更新)
以下是代码:
using (ClientContext clientContext = new ClientContext("https://sp13appstoredev.xyz.com/sites/DevApps/TrainingSite/"))
{
clientContext.Load(clientContext.Web, web => web.Title);
List oList = clientContext.Web.Lists.GetByTitle("Employees");
clientContext.Load(oList);
ListItemCreationInformation itemInfo = new ListItemCreationInformation();
Microsoft.SharePoint.Client.ListItem myItem = oList.AddItem(itemInfo);
myItem["Title"] = txtFirstName.Text;
myItem["Last_x0020_Name"] = txtLastName.Text;
myItem["u5ib"] = txtAge.Text;
myItem["Address"] = txtAddress.Text;
//FieldLookupValue lookUpDepartment = new FieldLookupValue();
//myItem["Department"] = lookUpDepartment as FieldLookupValue;
//FieldLookupValue lookUpManager = new FieldLookupValue();
//myItem["Manager"] = lookUpManager as FieldLookupValue;
myItem["Gender"] = radioBtnGender.Text;
myItem["Salary"] = txtSalary.Text;
myItem.Update();
clientContext.ExecuteQuery();
}
我评论了查找列的行以检查列表中的其他列是否正在更新。
请帮助。谢谢:)
【问题讨论】:
标签: sharepoint sharepoint-2013 sharepoint-online