在Office 365用户的Sharepoint Online上找不到EnsureUser的用户 [英] User not found for EnsureUser on Sharepoint Online with Office 365 Users

查看:165
本文介绍了在Office 365用户的Sharepoint Online上找不到EnsureUser的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

 我正在尝试在列表中添加项目,并且想向某些用户添加特定的授权.

 I am trying to add items in a list and I want to add specific authorisation to some users.

 我正在使用Sharepoint Client 16 dll,并且已连接到Sharepoint Online.我尝试用他们的登录名找到Office 365用户.

 I am using Sharepoint Client 16 dll and I am connected to a Sharepoint Online. I try to find Office 365 users with their login.

对于某些管理员用户,它可以工作,但对于非管理员用户,我有一个未找到用户异常".在法语中,确切的错误是L'utilisateurspécifié 令人难以置信.

For some admin users It works but for non admin users I have a "User not Found Exception" in French the exact error is L'utilisateur spécifié  est introuvable.

这是我的代码:

        RoleDefinitionBindingCollection   collRoleDefinitionBinding  =  new   RoleDefinitionBindingCollection (clientContext);          collRoleDefinitionBinding.Add(clientContext.Web.RoleDefinitions.GetByType( RoleType .Reader)) ; 

         RoleDefinitionBindingCollection collRoleDefinitionBinding = new RoleDefinitionBindingCollection(clientContext);          collRoleDefinitionBinding.Add(clientContext.Web.RoleDefinitions.GetByType(RoleType.Reader)); 

        用户  User  =  clientContext.Web.EnsureUser(loginUserOwner);         itemToUpdate.RoleAssignments.Add(User,  collRoleDefinitionBinding);

         User User = clientContext.Web.EnsureUser(loginUserOwner);          itemToUpdate.RoleAssignments.Add(User, collRoleDefinitionBinding);

        itemToUpdate ["Ann_x00e9_e" ]  =  annee;       &b ;         

         itemToUpdate["Ann_x00e9_e"] = annee;                     

        itemToUpdate [干预" ]  =  User;

         itemToUpdate["Intervenant"] = User;

        itemToUpdate.Update();

         itemToUpdate.Update();

        clientContext.ExecuteQuery();

         clientContext.ExecuteQuery();

我想念什么?

预先感谢

推荐答案

根据您的描述,我的理解是,当您使用ClientConext.Web.EnsureUser()方法验证用户时,对于某些非管理员用户,则会引发找不到用户异常".

According to your description, my understanding is that when you use ClientConext.Web.EnsureUser() method to validate user, then for some non-admin users, it throws "User not found exception".

在我的环境中,我还尝试使用16版本的SharePoint.Client.dll重现此问题,但没有成功.

In my environment, I also tried to use 16 version SharePoint.Client.dll to reproduce this issue, but with no success.

为更好地进行故障排除,建议您在Visual Studio中使用非管理员用户作为loginUserOwner参数时尝试调试代码.

For a better troubleshooting, I suggest you can try to debug the code when using non-admin user as loginUserOwner parameter in Visual Studio.

您还可以检查用户信息是否在管理网站中有特定说明.

Also you can check if the user information has some specific in the Admin site .

您可以尝试创建一些新的测试用户,然后向站点添加读取权限,然后使用代码进行调试以查看其是否有效.

You can try to create some new test user and then add read permission to a site, then debug with the code to see if it works.

谢谢

最好的问候


这篇关于在Office 365用户的Sharepoint Online上找不到EnsureUser的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆