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?

有帮助吗?

解决方案

The profile property is actually a UserProfileValueCollection.

e.g.

UserProfileValueCollection propertyCollection = profile[propname];
foreach(var prop in propertyCollection)
{
    Console.WriteLine(prop.ToString());
}
许可以下: CC-BY-SA归因
scroll top