Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to talk to Sharepoint: If I only got Full Name
    primarykey
    data
    text
    <p>It seems like every effort talking to Sharepoint through its web services needs a domain\user name. For example:</p> <pre><code>UserProfileService.GetUserProfileByName(string accountName) </code></pre> <p>The accountName should be domain\user name.</p> <p>If I only got full name (FirstName LastName), is it possible to communicate with SharePoint? Is there any way to convert the full name into domain\user name? Is domain\user name the only way to do it?</p> <p>Thank you in advance. :)</p> <hr> <p>Thank you for the answers. :)</p> <p>The code looks like this:</p> <pre><code>using System.DirectoryServices; const string ADPATH = "LDAP://myLDAPserver,validUserforAD"; const string USERNAME = "myDomain\\myUserName"; const string PASSWORD = "myPassword"; const string DOMAIN = "myDomain\\"; public static DirectoryEntry GetDirectoryObject() { DirectoryEntry directoryObject = new DirectoryEntry(ADPATH, USERNAME, PASSWORD, AuthenticationTypes.Secure); return directoryObject; } public string GetUserNameByCompleteName(string completeName) { DirectoryEntry adObject = GetDirectoryObject(); //filter based on complete name DirectorySearcher searcher = new DirectorySearcher(adObject); searcher.Filter = "displayname=" + completeName; SearchResult result = searcher.FindOne(); DirectoryEntry userInfo = result.GetDirectoryEntry(); //getting user name string userName = (string)userInfo.Properties["samaccountname"].Value ?? string.Empty; userInfo.Close(); adObject.Close(); return DOMAIN + userName; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload