Recently, I created a canvas app for a customer. An email needs to be sent when a record is updated. A SharePoint Online list is used to store the records. In the email, the name of the person who made the change and (!) the name of a person selected in a “Person or group” field had to be shown.
This could be the same person, and when this was the case, different values were shown. This is of course unwanted and a fix was needed.
The name of the person in the “Person or Group” field was shown using something like: combobox.Selected.DisplayName
. The name of the person who modified the record was shown using User().FullName
.
The reason for the different values was that DisplayName and FullName are not the same. FullName is based on the Azure Active Directory properties “First name” and “Last name”. DisplayName is the Azure Active Directory property “Display name”.
The fix was not to use User().FullName
but Office365Users.MyProfileV2().displayName
. An extra connection (Office 365 Users) was needed but now, the same name is shown. Happy customer, Happy me!