Monday, September 20, 2010

CODE: HOW TO Remove Domain portion from SharePoint User ID

Use the code to below to strip out the DOMAIN\ portion from a SharePoint Active Directory user account:
 
string domainUser = Regex.Replace("domain\\user",".*\\\\(.*)", "$1",RegexOptions.None);


OR

string shortName = System.IO.Path.GetFileNameWithoutExtension(ResourceLoginName);

 

 

 

 

No comments: