I'm setting some user profile properties using CSOM, specifically some properties backed by term sets. The only way to do this (that I know of) are the SetSingleValueProfileProperty
and SetMultiValuedProfileProperty
methods of the Microsoft.SharePoint.Client.UserProfiles.PeopleManager
object. These work fine to set the property values when using simple term sets, but not as well if the term set has a hierarchical structure.
In my specific example we're setting a user's location, and the term set has a hierarchical structure of
Country -> City
So every City is a child of a Country. Assuming the terms already exist in the term set you can simply pass in the name of a City and it will find that nested term and use it, no problem. But consider the case when we have both Paris, France and Paris, USA in the term set. Passing in the string "Paris" will set the property to the first Paris it finds (Paris, France), but how can I set the value to be Paris, USA instead?
I tried passing in USA:Paris, which resulted in a new term named that. I also tried passing in Paris|GUID_OF_TERM but that fails saying | is an illegal character.
Does anyone have a way to specify a specific nested term when setting a profile property using CSOM?