lwhitelock / HuduM365Automation

Hudu Microsoft 365 Syncronisation Tool
GNU Affero General Public License v3.0
29 stars 72 forks source link

Exiting assets (people) are ignored #4

Open Tan-DE opened 2 years ago

Tan-DE commented 2 years ago

Since in most cases the field "primary_mail" in the People Asset is empty (in our case at least after an IT GLUE migration), it might be helpful to make the additional field for the email address configurable as a parameter.

Example:
#$HuduUser = $People | where-object { $_.primary_mail -eq $user.UserPrincipalName }
$HuduUser = $People | where-object { ($_.fields.label -eq 'E-Mail') -And ($_.fields.value -eq $user.UserPrincipalName) }
lwhitelock commented 2 years ago

The issue with this is every integration can store the email in a different place. The primary email is what should be set now we can do it via the API. The other issue would be that, that is the mechanism which contacts created by the integration can then be matched so you would also have to add logic to extend it to adding the email to that filed on creation. The better solution I can think of would be running a one off script to loop through all the imported assets and just update their primary_mail attribute based off the field that is set.