客户端对象模型,找不到站点用户?

Client Object Model, cannot find site user?

当 运行 程序时,我得到 ServerException。这是我的代码:

 ClientContext context = new ClientContext("http://myRUL");
 Principal user = context.Web.SiteUsers.GetByLoginName(@"myRealAccoutLoginIn");
 RoleDefinition readDef = context.Web.RoleDefinitions.GetByName("Approve");//"Approve" is the permission I want to give to the user

 RoleDefinitionBindingCollection roleDefCollection = new RoleDefinitionBindingCollection(context);
            roleDefCollection.Add(readDef);
 RoleAssignment newRoleAssignment = context.Web.RoleAssignments.Add(user, roleDefCollection);

 context.ExecuteQuery(); 

这里是详细异常:

我可以向你保证 SiteUsers 存在于网站上,下图中的红色圆圈是我的共享点帐户:

Web.SiteUsers 在 SharePoint 2010 中不存在,不建议在 SharePoint 2013 中使用。

尝试使用 Web.EnsureUser("<username>") (documentation) 获取委托人。