SOLVED

Accented characters lost when calling Microsoft Graph from Powershell script

Copper Contributor

Hi,

 

I wrote a script to create, update or delete contacts in one of my Exchange contacts folder by using Invoke-RestMethod cmdlet to call Microsoft Graph API.

The issue is that accented characters are replaced with the Unicode replacement character (a black diamond with a white question mark) in contacts properties where such accented characters should be displayed.

 

For instance when updating jobTitle property with characters 'éçèà', I get four replacement characters as shown in the attached file.

 

I tried with :

- PowerShell ISE 5.1

- PowerShell 7.0.3 terminal

- VS Code 1.50.1 with Powershell Extension 2020.6.0

- PowerShell within Azure Function

 

Calling Microsoft Graph API with some other API specialized software is successful : the accented characters get displayed in the Exchange contacts properties.

 

I'm a beginner in PowerShell scripting and with all aspects of using .Net functionalities.

 

Thanks for your help.

2 Replies
best response confirmed by AlainKlein (Copper Contributor)
Solution

@AlainKlein 

I did not work yet with MG, but did you try the following

But I can refer you to similar case

https://powershell.org/forums/topic/character-encoding-with-invoke-restmethod/

Plus you can get more information about the encoding from here.

https://docs.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/understanding-file-encod...

 

@farismalaeb 

 

Hi,

Thanks a lot for your reply : one of the solutions provided in Topic: Character encoding with Invoke-RestMethod | PowerShell.org works for us. :)

 

Many thanks for your advice and time spent responding to us.

 

Have a nice day.

Stay safe.

 

Alain Klein

 

1 best response

Accepted Solutions
best response confirmed by AlainKlein (Copper Contributor)