Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Need to get back the windows id from the UserProfileManager in C#, please help...

$
0
0

Hi Guys, I need to get back the account ID or windows ID from UserProfileManager, so far the only thing I have been able to get back is the displayName. Here is my code:

using (SPSite mySitesCollection = newSPSite("http://sps-dev-01/my"))

{

//Get the user profile manager

SPServiceContext context =SPServiceContext.GetContext(mySitesCollection);

UserProfileManager profileManager =newUserProfileManager(context);

//How many user profiles are there?

Console.WriteLine("There are "+ profileManager.Count +" user profiles.");

//Loop through all the user profiles

foreach (UserProfile currentProfile in profileManager)

{

ProfileValueCollectionBase profileValueCollection = currentProfile.GetProfileValueCollection("PictureURL");

//Only display something if the user has set their picture.

if ((profileValueCollection !=null) && (profileValueCollection.Value != null))

{

//There is always a display name

Console.WriteLine("User:"+ currentProfile.DisplayName +"<br />");

//There is a picture so display it

//Console.WriteLine("Picture:" + profileValueCollection.Value.ToString() + "");// Value.ToString()+ "");   }

}  Thanks in advance,


Best regards, Mike


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>