设置权限时 Sharepoint 2010 中出现用户未找到错误
我有一个在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有提供任何代码示例。
您在分配权限之前调用 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