Closed mdurini-swisscom closed 1 year ago
Yes, that's correct, sorry I forgot to mention that in the blog. The name of the list depends on the settings of your tenant.
Use this url to find out what it's called in your tenant:
https://<your domain>.sharepoint.com/sites/<your site name>/_catalogs/users/simple.aspx
I can get the name via the url, but if i try to substitute it, I still get an empty result. If i'm running the command without the filter option in the URL, i get two lists
So what is the name of the user information list in your language?
$userInformationListId = (Invoke-RestMethod -Method Get -Headers $Header -Uri "https://graph.microsoft.com/v1.0/sites/$($sharePointSite.id)/lists?`$filter=displayName eq 'Benutzerinformationsliste'").value.id
You should be able to replace Benutzerinformationsliste with the list name in your language. Keep the white spaces and the '' surrounding the name. Also keep the back tick before the `$.
This worked for me in German and English.
$userInformationListId = (Invoke-RestMethod -Method Get -Headers $Header -Uri "https://graph.microsoft.com/v1.0/sites/$($sharePointSite.id)/lists?`$filter=displayName eq 'User Information List'").value.id
The funny thing is that I don't get it from powershell but i can find it from the URL
even removing the filter part from the url is not showing it
The filter part has to be there. Otherwise it won't be found because it's hidden. If it was found without the filter, it would have made things a lot easier. I checked my tenant again yesterday. In the browser it's called User Information List but with PS I can only find it using Benutzerinformationsliste. I suggest to search what possible names in the language of your tenant are.
It makes sense now. you can close this issue ;) thank you
I think I found a way to dynamically get the id of the user information list, regardless of the localization. https://github.com/mozziemozz/TeamsPhoneAutomation/commit/6cbb1a4b9160c0b2dcd62753868249916acbd9ab
This command is not returning any result
$userInformationListId = (Invoke-RestMethod -Method Get -Headers $Header -Uri "https://graph.microsoft.com/v1.0/sites/$($sharePointSite.id)/lists?`$filter=displayName eq 'Benutzerinformationsliste'").value.id
as I understood, Benutzerinformationsliste is the User Information List, a hidden list containing all the users stored in a SharePoint site. Benutzerinformationsliste seems to be the German name.