"属性或字段尚未初始化"尝试将用户添加到sharepoint组时出错

时间:2017-02-01 12:50:48

标签: c# sharepoint-2010

查找"属性或字段尚未初始化。尚未请求或请求尚未执行。可能需要明确要求。"尝试将用户添加到sharepoint组时出错。 这是代码:

string temp="r2\user"; //domain\user
User user = web.EnsureUser(temp);
using (ClientContext clientContext = new ClientContext(url))
{
Web web = clientContext.Web;
Group testingOwnersGroup = web.SiteGroups.GetById(grpId);
UserCollection collUser = testingOwnersGroup.Users;
collUser.AddUser(user);
clientContext.Load(user);
clientContext.Load(testingOwnersGroup);
clientContext.ExecuteQuery();
}

请帮帮我!!!

0 个答案:

没有答案