The right way to find a SPUser in SharePoint 2013
Posted
by Sahil Malik
on Win Smarts
See other posts from Win Smarts
or by Sahil Malik
Published on Sun, 02 Jun 2013 04:16:24 GMT
Indexed on
2013/06/24
16:32 UTC
Read the original article
Hit count: 323
sharepoint
SharePoint, WCF and Azure Trainings: more information |
Obvious stuff out of the way, SharePoint 2013 is claims and claims only. If you’re still pimping classic windows identities, you’re a fool. But this creates an interesting wrinkle. How the hell is one supposed to find a SPUser? This, especially given that a user id now looks like this - i:0#.w|ws\administrator .. all of those have a meaning .. i stands for identity 0 is the zero’th registered claims provider w before the pipe is windows and after pipe is the final username. What if I had a hotmail account called ws\administrator? You see, browsing through web.SiteUsers, is no longer enough. Not only is it error prone, it won’t work for any other identity type besides Windows. So what is a poor SharePoint developer to do? Easy. Use the cod below instead,
© Win Smarts or respective owner