Question

I defined a multi value string for user profile properties in the backend of my SharePoint 2010. I'm reading the content from the created property like this: propertyValue = profile[propname].Value.ToString(); unfortunately i'm getting only the first stored value of the multi value field.

profile in the code is of type UserProfile and has GetUserProfile(accountName) from the UserProfileManager in it

Any Ideas how to get all multi values?

Was it helpful?

Solution

The profile property is actually a UserProfileValueCollection.

e.g.

UserProfileValueCollection propertyCollection = profile[propname];
foreach(var prop in propertyCollection)
{
    Console.WriteLine(prop.ToString());
}
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top