How can i get all Sharepoint folders using Graph API? - microsoft-graph-api

Currently I am creating a site in Sharepoint and associating it with Teams and then when i access the Sharepoint folders I call.
https://graph.microsoft.com/v1.0/me/joinedteams
or can i access the Sharepoint folders directly through a different endpoint ?

Related

Is it possible to give read permissions to users in sharepoint using Microsoft Graph

I'm using Microsoft Graph API to upload large files to sharepoint using createUploadSession endpoint.
Is there a way to give read permissions in upload process to a specific user or I have to use other endpoint for this?
Yes it is possible to manage and change permissions of SharePoint online using Microsoft Graph API EndPoints: link
Permissions are managed separately through MS Graph End Points designated for permissions: link
Another stackover article on the same with slight different issue: link

Get role inheritance state for document library in SharePoint Online

I work with SharePoint Online drives(document libraries) with Microsoft Graph API (/drives call). With this API I can download/upload files but cannot work with permissions.
That's not a problem - I can do it with SharePoint Online REST API (with calls _api/web/GetListByTitle('Title')/hasuniqueroleassignments).
The main problem here is matching drive from MS Graph API and a corresponding list from SharePoint REST API. For now I match by title but I have several examples, when name field in MS Graph API is equal to "OneDrive", but title in List entity is Shared Pictures.
My question is: is there any way to match more precisely entities from Graph API and SharePoint REST API?
Thank you.
The Drive Item object has a SharePointIds property that will provide the information necessary to call the SharePoint REST API.
https://learn.microsoft.com/en-us/graph/api/resources/sharepointids?view=graph-rest-1.0
Use List resource, you could get list id.
Then use id to call rest api.
/_api/web/Lists(guid'54ca94c0-364e-4201-8fe7-a4c804769009')/hasuniqueroleassignments

Are all sites a subsite of the root site in Microsoft Graph?

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

Get SharePoint Groups (not AD groups) using Graph API

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.

App for Office for Desktop and 3rd party authentication

I am initiating an App for Office project and I am trying to find out something critical.
Can I use my ASP.NET MVC built-in OAuth authentication to pair it with a Live account so my app logs-in the user into MS Office for Desktop apps.
This is needed so I can access OneDrive and use the share file editing there.
The architecture so far is:
Files stored in a single OneDrive or SharePoint server (TBD)
Desktop Office apps (Word and Excel) where the users work.
App for Office, installed in their Word and Excel. Users can authenticate on the back-end ASP.NET MVC server, using any 3rd party email address and a password.
I have used OAuth in ASP.NET MVC projects but not in integration with Office in an App for Office.
So, my question is if this idea is possible and HOW, or I have to give everyone an Office 365 account so they can connect via the integrate Office for desktop.
As we in our small company like to benefit from the OneDrive functionality, and also want to have selected shared and group folders offline available, we found a more or less perfect workaround.
We use the Goodsync software to synchronize. For this you create a sync job within Goodsync for the folders you want to have offline- available. Such a sync definition / call it folder pair / has a reference to the local folder, and on the other side a reference to the OneDrive folder. The reference to the OneDrive folder you describe like this: „sds://d.docs.live.net//“.
The OneDrive CID you can see for any shared OneDrive folder in OneDrive web whithin its web address (example: https://OneDrive.live.com/?cid=xxxxxxxxxxxxxxxx) . Similarly it works for OneDrive group folders.
Our experience is very good with this workaround, only to be aware to have all rights for the shared One Drive folder, then Goodsync can even create or delete folders within shared OneDrives.
Good luck! Wolfgang from Salzburg
For everyone's benefit, I will explain what we have done.
We are using Azure Active Directory and manage all users there. We connected SharePoint site to it and it has a OneDrive behind. Now our App for Office connects to that using SharePointContext from here and it magically works.

Resources