Forum Discussion
SteinG645
Jan 25, 2023Copper Contributor
M365 - Export all contacts from my users
Dear awesome people of the community, I’ve been trying for multiple days together with someone else (that person is more technical) to make a script that can export all contacts of my user’s mail...
SteinG645
Copper Contributor
Harm_Veenstra Thank you for replying. It seemed that we got the script only functioning on my account, most probably because of the language. (me as admin has everything in EN, while everyone else has their locale in NL).
Using GraphAPI my colleague seemed to get the same issues, no "contacts" store was found for any NL users
https://learn.microsoft.com/en-us/graph/api/user-list-contacts?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/api/contactfolder-get?view=graph-rest-beta&tabs=powershell
Do you have any experience using this script, or any other script/GraphAPI for extracting contactpersonen (dutch for Contacts) store and getting that export in a format that is usable in Excel?
Feb 02, 2023
I don't have experience in this particular action yet, but can you specify the name of the contact folder in the script? Check for contacts folder, if not present use contactpersonen?
- SteinG645Feb 02, 2023Copper ContributorMy collegue (far more technical than me) wasn't able to find a way via the script to change the name for the searched store (from contacts to contactpersonen) 😞
- aterneuzenFeb 03, 2023Brass ContributorEven when you do a get-mailbox you can check for prefered language.
But that on the side.
So if i get it right you want to export from every user there contacts and combine them ?
You could use the graph api.
https://learn.microsoft.com/en-us/graph/api/user-list-contacts?view=graph-rest-1.0
With the first you will get the name: contacts of contactpersonen already in a variable so it doesn't matter then anymore.