User photos lost in synchronization > Flow to the rescue: Set Entity Image

Posted by

I’ve demoed this simple but effective automation solution with Flow during my session ‘Automate your Dynamics 365 admin tasks with Flow!’ at Dynamics 365 Saturday Belgium in Brussels last Saturday.

User photos in Office 365 are not synced to Dynamics 365. And if there’s no photo available in Office 365, at least there’s an avatar with the initials of the user. It would be nice to have the same photo or alternative in Dynamics 365, so I’ve created a Flow to do the job.

Here is the overview of the Flow:

I get the list of active users and for each user I try to get their user photo from Office 365. When a photo is available, the flow will continue at the scope Succeeded to set it as the User entity image in Dynamics 365. When no photo is found the Flow action will fail and follow the Failed scope to get an avatar with the initials of the user instead.

I want to try to compare the content of the user photo with the entity image if present, so the User record will only be updated when they differ. But that doesn’t seem to work, probably because of different formats.

The User record is updated with the Image file content of the Get user photo action every time the Flow runs.

If there’s no photo found, the actions in the Failed scope will get an avatar with the initials of the user and set that as User entity image in Dynamics 365.

The layout of the avatar can be set by the query parameters (see UI Avatars for more info).

In this way users will have the same image in Office 365 and Dynamics 365.

After my session I was asked by someone from Microsoft Belgium to share the Flow so they could use it and save time enabling demo environments for Dynamics 365 Customer Engagement with Resource Scheduling where user photos are a must.

Here is the download link of the Flow ‘D365: Get & Set User entity image‘.

For bulk upload of user photos to Office 365 there’s a freeware tool available: CodeTwo User Photos for Office 365.

BTW: in another environment the Flow action ‘Get user photo (V2)’ doesn’t fail when there’s no photo found, so I had to modify the Flow like this: Check if User photo is not empty

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *