Sunday, June 12, 2011

SharePoint 2010 - i:0#.w|domain\username issue in User

Hi Friend,

Yesterday When I fetched user name through object model, I am getting user name like i:0#.w|domain\username. Because It is possible in claim based authentication in sharepoint.

To Solve this problem, decode the account name.

using Microsoft.SharePoint.Administration.Claims;
SPClaimProviderManager mgr = SPClaimProviderManager.Local;
string strDecodedLoginName = "";


strDecodedLoginName = mgr.DecodeClaim(strLoginName).Value;