Deriving first names from display name is a bad idea
For sorting reasons our company uses display name in the format last name followed by first name; e.g. "Ponguillo Intriago Ronald Alberto"
In Teams, email and activity feed show silly information such as "Ponguillo posted". Or even "De posted" for "De Feyter Kim" (De Feyter = last name).
In order to send a notification with a “friendly” intro referring to the first name of the submitter In Teams, you ASSUME that the first chars up to the first space is in fact the first name. It clearly is not if the display name is in the format last name + first name.
Another example of another “display name” (if that is used to “guess” first names): “Ronald Alberto Ponguillo Intriago”
You would use “Ronald” as first name (by guessing) while his first name is “Ronald Alberto”.
If the user object’s first name in AAD would be used, it would correctly refer to “Ronald Alberto”.
I would suggest to use the following rules for Team email notifications and items in the Activity feed:
• If the user object has first name filled out in AAD, then use this for display purposes
• If the user object is a guest -–guests are not required to complete first/last name when accepting invite and being added to AAD-- then “guess” based on provided display name. (=the current solution apparently in both cases)
BTW, we have already pointed out earlier that when a guest is invited in Teams AND that guest is a member of another O365 tenant, their first name/last name should be copied into the inviting tenants AAD. Only the display name is read from their profile currently… this screws up the user search in AAD.
Matt Pearn commented
In an educational setting like ours, display names are set to 'title initial surname', like 'Mr J Smith' - this results in group chats on Teams that say 'Mr, Mr, Mrs and Mr' and updates like 'Mr mentioned you in a post'. Not super helpful...
It doesn't really make sense to use the first word of Display Name and assume it's the first name of a person.
Some persons have two names which form a first name.
Some companies have a format "Lastname Firstname" as display name.
You have all required information at your fingertips, use it. Use it to know what the actual Firstname is.