查找"属性或字段尚未初始化。尚未请求或请求尚未执行。可能需要明确要求。"尝试将用户添加到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();
}
请帮帮我!!!