How to get domain\user notation of an account if it is in claim format
28/06/2013 Leave a comment
You can convert claim format into domain\user format ;
string Username;
SPClaimProviderManager mgr = SPClaimProviderManager.Local;
if (mgr != null && SPClaimProviderManager.IsEncodedClaim(SPContext.Current.Web.CurrentUser.LoginName))
{
Username= mgr.DecodeClaim(SPContext.Current.Web.CurrentUser.LoginName).Value;
}
else
{
Username= SPContext.Current.Web.CurrentUser.LoginName;
}
More details of the SPClaimProviderManager methods:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.claims.spclaimprovidermanager_methods.aspx