Click here to Skip to main content
15,944,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a method to get the profile properties of a user in SharePoint client object model by passing Preferred Name of the user?

We are using UserProfileService web service and it has method to get the user profile by passing the username but not Preferred Name.

Thanks in advance.
Posted
Updated 6-Jan-12 0:41am
v3
Comments
Slacker007 6-Jan-12 6:58am    
Shorten the subject title. Put the question in the body. Just a suggestion.

1 solution

I found the solution ....

User user = clientContext.Web.EnsureUser("Preferred Name");

clientContext.Load(user);

clientContext.ExecuteQuery();

Now user.LoginName will give the username of the user and then we can make use of the UserProfileService web service to get the user profile properties.

userprofileservice.UserProfileService svc = new userprofileservice.UserProfileService();

userprofileservice.PropertyData[] properties = svc.GetUserProfileByName(userNoeId);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900