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?

Était-ce utile?

La solution

The profile property is actually a UserProfileValueCollection.

e.g.

UserProfileValueCollection propertyCollection = profile[propname];
foreach(var prop in propertyCollection)
{
    Console.WriteLine(prop.ToString());
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top