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