1

I have a SharePoint list and i want to get the user's job title (created by) from AD. Is there any easy way to find it. I been able to retrieve user email address. but now need to find the job title from AD

1

You don't mention how you extracted the mail address, but if you already extract the email address, you can use the same technique to get the job title. To extract the email address from the user profile, I assume you have used the "WorkEmail" property. To get the job title, use the "Title" property.

A full list of user profile properties is here:

http://technet.microsoft.com/en-us/library/hh147513(v=office.14).aspx

0

If you are using SharePoint Server, you can query User Profile Services. It automatically syncs data from AD.

Otherwise, the other way I can think of is an Event Receiver (or Workflow) that happens on item create. Then develop a code that queries AD for the information that you need.

0

There are two approaches that I am aware of.

(1) I have answered a similar question to retrieve user details from AD, have a look here

Get Current User's Department Name and Manager From Active Directory

For your reference:

protected getADUserInfo()
    {
       DirectorySearcher dsearcher = null;
       string jobTitle = string.Empty;

       DirectoryEntry dentry = new DirectoryEntry();
       DirectoryEntry de = new DirectoryEntry();
       dentry.Path = "your AD ldap path";
       dentry.Username = "*****\\domain;";
       dentry.Password = "******";
       DirectorySearcher dsearcher = new DirectorySearcher(dentry);
       dsearcher.Filter = String.Format("(&(ObjectCategory=Person)(sAMAccountName=" +  LoginName+ "))");
       SearchResult searchResult = dsearcher.FindOne();
       de = searchResult.GetDirectoryEntry();

                if (searchResult != null)
                {
                    if (de.Properties.Contains("title"))
                    {
                        jobTitle = de.Properties["title"][0].ToString();
                    }
                }
    }

(2) Using jQuery library, $().SPServices.SPGetCurrentUser

http://spservices.codeplex.com/wikipage?title=$().SPServices.SPGetCurrentUser&referringTitle=Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.