I have a SharePoint modern team site with an associated group. I have the url for the site. I need to get the groupid from that url. Is that possible with Microsoft Graph?
Try
https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq 'modernsitename'&$select=id
Related
I am trying to get informations about user/mailbox type (regular, distribution list, shared mailbox, alias) using the Microsoft graph API. I tried using the /users endpoint but I see there is no field with such info. Is there any way of doing this?
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
Thanks!
That information is only available from Exchange PowerShell (Get-Mailbox), which isn't yet available via Graph. You can get a list of groups (https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=http) and a list of users (https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http). I don't know if that will work for your purposes.
I am attempting to retrieve all SharePoint Sites via the Microsoft Graph REST API
Looking at the Site resource, I can see there are methods to get a root site, to get subsites, but also, to get sites by group.
Are all SharePoint sites, including group sites able to be found as subsites of the root site? Or do I need to retrieve every group and enumerate those too?
To retrieve all the sites across tenant Search for sites endpoint could be utilized, for example:
GET https://graph.microsoft.com/v1.0/sites?search=*
To retrieve only group sites indeed, it appears the only supported approach would be to:
list all the groups, for example: GET https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c+eq+'Unified')&$select=id
and enumerate every group to retrieve group site: GET https://graph.microsoft.com/v1.0/groups/{group-id}/sites/root
No. The organization root is a sibling to group sites.
The API does have a basic search capability, if that helps.
https://learn.microsoft.com/en-us/graph/api/site-search?view=graph-rest-1.0
Is there anyway to get a list of Sharepoint Online sites equivalent to the Get-SPOsite cmdlet?
Yes, you can use the Search for Sites endpoint and pass a wildcard as your query. See example below:
https://graph.microsoft.com/v1.0/sites?search=*
This will return all sites in the tenant.
Is there a method to retrieve SharePoint Groups using Microsoft Graph?
I can get Azure Directory groups using https://graph.microsoft.com/v1.0/groups but what I'm looking for are SharePoint Groups.
I could get a SiteCollection using https://graph.microsoft.com/beta/sites/{id} but I couldn't seem to get the SharePoint Groups in site collection.
This is not very easily accessible in just the Microsoft Graph. If you had some access to the SharePoint API, you could get the GUID from the "User Information List" - which seems hidden from the Microsoft Graph at this time. That SharePoint API call would be
GET HTTP https://sometenant.sharepoint.com/_api/web/lists?$select=title,id&$filter=Title%20eq%20%27User%20Information%20List%27
Once you have that GUID for that list you could do the Graph call:
https://graph.microsoft.com/beta/sites/{site id}/lists/{list ID from the SharePoint API}/items
That will get you the full list of members, including groups. This is still a hack since the groups you'd have to filter by contentType/name eq 'SharePointGroup' - which seems buggy in Graph Explorer anyways. Trying to programmatically access that, would be difficult at this time.
I'm creating an office group using Microsoft Graph API. After that I would like to create a Microsoft Team which is associated with the group. I can do this step manually, but I'm wondering if it's also possible to do so via API.
Graph API doesn't seem to support Microsoft Teams yet. Am I correct?
You are correct, Teams is not yet part of the Graph API, nor do we yet have support for creating Teams. Both are on the road map, but I do not have an ETA for you at this time.
Actually you can do this semi-automatically using the beta API on Skype. Here is a GitHub project doing this from PowerShell: https://github.com/sanderdewit/teams-module
This approach is semi-automatically, because you need a user to sign-in once via a pop-up window. And for sure this is not a supported scenario.