Take the 2-minute tour ×

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 ?

share|improve this question

1 Answer 1

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).


share|improve this answer
This was not the issue, the problem was, when you click ok after you find the user, the second search with claim returns duplicate values –  Mug Developer Apr 12 '11 at 6:51

Your Answer


