exception thrown if user property retrieved
-
22-10-2019 - |
Question
I'm retrieving different custom and default user properties from the my sites profile in a webpart.
The Problem is, if i'm trying to retrieve profile information which hasn't been set yet the webpart throws a System.NullReferenceException.
How can i check if the property is set to work around that problem?
Solution
if (properties["MyProperty"] != null) { ...
?
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange