设置权限时 Sharepoint 2010 中出现用户未找到错误

发布于 2024-10-04 01:29:24 字数 228 浏览 0 评论 0原文

我有一个在 Sharepoint 2010 中进行角色分配的代码。 此分配发生在 2 个不同的时间。 1. 在实现 SPEventItemReceiver 的类中的 ItemUpdated 事件中,这里一切正常。 2. 在我们想要更新权限时执行的函数中。

函数 1 和函数 2 中的代码相同,但在函数 2 中,我们收到“用户未找到”错误。 事件处理程序是否在不同的上下文/用户下运行?我不知道如何解决这个问题。 有什么建议吗?

I have a code that is doing role assignment in Sharepoint 2010.
This assigment occurs at 2 different times.
1. In the ItemUpdated event in the class that implement SPEventItemReceiver, everything is working fine here.
2. In a function that is executed when we want to update permissions.

Code in function 1, and function 2 are identical, however in function 2 we are getting User not found error.
Is the event handler running under a different context/user ? I don't know how to approach this problem.
Any suggestions ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你怎么这么可爱啊 2024-10-11 01:29:24

您没有提供任何代码示例。

您在分配权限之前调用 SPWeb.EnsureUser() 吗?

此方法将确保用户存在(如果用户尚未登录,则不会“存在”在 SharePoint 用户列表中)。

http://msdn.microsoft.com/en-us /library/microsoft.sharepoint.spweb.ensureuser.aspx

You did not provide any code samples.

Do you call SPWeb.EnsureUser() before assigning rights?

This method will ensure that the user exists (it wont "exist" inside SharePoints user list if the user havent logged in).

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.ensureuser.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文