Create/Update personal contacts with Powershell SDK

%3CLINGO-SUB%20id%3D%22lingo-sub-2991996%22%20slang%3D%22en-US%22%3ECreate%2FUpdate%20personal%20contacts%20with%20Powershell%20SDK%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2991996%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Emy%20goal%20is%20to%20sync%20active%20directory%20users%20to%20users%20personal%20outlook%20contacts.%20I%20try%20it%20and%20it%20seems%20to%20be%20very%20easy%20but%20after%20a%20several%20tries%20I%20mentioned%20that%20the%20%22Display%20as%22%20field%20wasn't%20filled%20correctly.%3C%2FP%3E%3CP%3EIt%20always%20filled%20out%20with%20the%20Surname%20and%20the%20Givenname%20instead%20of%20what%20I%20want%20to.%20(Givenname%20Surname%20%2B%20mailaddress)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EWhat%20I%20found%20out%20is%20that%20the%20field%20is%20only%20filled%20out%20incorrectly%20for%20users%20with%20a%20Exchange%20Online%20license.%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EThe%20field%20is%20filled%20in%20correctly%20for%20users%20who%20do%20not%20have%20a%20license%20and%20I%20really%20don't%20know%20why%3F%20Can%20anyone%20explane%20me%20why%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24anzeigenals%3D%24displayName%20%2B%20%22%20(%22%20%2B%20%24EmailAddresses%20%2B%20%22)%22%0A%24MAIL%3D%20%40%7BAddress%20%3D%20%24EmailAddresses%3B%20Name%20%3D%20%24anzeigenals%7D%0A%0ANew-MgUserContact%20-UserId%20%24graphuser.Id%20-BusinessPhones%20%24BusinessPhones%20-CompanyName%20%24CompanyName%20-Department%20%24department%20-DisplayName%20%24displayName%20-FileAs%20%24FileAs%20-GivenName%20%24GivenName%20-JobTitle%20%24Jobtitle%20-Initials%20%24Initials%20-Manager%20%24Manager%20-MobilePhone%20%24MobilePhone%20-OfficeLocation%20%24OfficeLocation%20-Surname%20%24Surename%20-EmailAddresses%20%24mail%20-BusinessAddress%20%24Anschrift%20-PersonalNotes%20%24personalnotes%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3007466%22%20slang%3D%22en-US%22%3ERe%3A%20Create%2FUpdate%20personal%20contacts%20with%20Powershell%20SDK%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3007466%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20everyone%20who%20want%20to%20know%20more%20about%20the%20problem%20we%20discuss%20this%20here%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fanswers%2Fquestions%2F636236%2Fcreateupdate-personal-contacts-with-ms-graph-power.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%2FUpdate%20personal%20contacts%20with%20MS%20Graph%20Powershell%20SDK%20-%20Microsoft%20Q%26amp%3BA%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

my goal is to sync active directory users to users personal outlook contacts. I try it and it seems to be very easy but after a several tries I mentioned that the "Display as" field wasn't filled correctly.

It always filled out with the Surname and the Givenname instead of what I want to. (Givenname Surname + mailaddress)

 

What I found out is that the field is only filled out incorrectly for users with a Exchange Online license. 

The field is filled in correctly for users who do not have a license and I really don't know why? Can anyone explane me why?

 

 

 

$anzeigenals=$displayName + " (" + $EmailAddresses + ")"
$MAIL= @{Address = $EmailAddresses; Name = $anzeigenals}

New-MgUserContact -UserId $graphuser.Id -BusinessPhones $BusinessPhones -CompanyName $CompanyName -Department $department -DisplayName $displayName -FileAs $FileAs -GivenName $GivenName -JobTitle $Jobtitle -Initials $Initials -Manager $Manager -MobilePhone $MobilePhone -OfficeLocation $OfficeLocation -Surname $Surename -EmailAddresses $mail -BusinessAddress $Anschrift -PersonalNotes $personalnotes

 

 

 

 

1 Reply

For everyone who want to know more about the problem we discuss this here:

Create/Update personal contacts with MS Graph Powershell SDK - Microsoft Q&A