I would like to create SPSite object and pass user token as an argument to make sure all operations are executed with SharePoint security trimming. Inside SPSite I am reading some file content using File.OpenBinaryStream() method.
I am not sure if there is a way to create SPUser using user credentials. I am able to get SPUser by getting it from SPWeb.AllUsers collection using user login name. However it doesn't work for claims based sites as login name for these users looks like i:0#.w|domain\username.
Am I allowed to user code like this:
SPUser user = web.AllUsers["i:0#.w|domain\username"];
to get SPUser object? I know that 'w' from 'i:0#.w' string means that it is Windows user. What do other symbols mean? Is there any method which can generate login name from user credentials so I may use it to get SPUser from AllUsers collection?
Possibly there are some other ways to execute code for SPSite under some SharePoint user privileges?
P.S. All my code is running out of SharePoint context. I have tried to user windows impersonation but got Access Denied error.
Thanks beforehand for any help,
View Complete Post