开发者

User not found error in Sharepoint 2010 while setting permissions

开发者 https://www.devze.com 2023-01-26 20:06 出处:网络
I have a code that is doing role assignment in Sharepoint 2010. This assigment occurs at 2 different times.

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 workin开发者_StackOverflow社区g 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 ?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消