Easy getting the URL of the library where Group’s files are stored with the new Files API
Get the URL of the library where your Group's files are stored
Previously, it was hard to get the URL of the location where Group's files were stored. Using the partial information provided by the Group Files API you had to make assumptions which resulted in correct URLs most of the times but not always. Using the new APIs you can get the exact URL of the library where your Group's file are stored.
Getting the URL of the library where your Group's files are stored is easy and consists of the following two steps:
1. Get your Groups
GET https://graph.microsoft.com/beta/me/joinedGroups Authorization: Bearer xyz Accept: application/json;odata.metadata=full
As mentioned in my previous post, the trick is to set the Accept header to application/json;odata.metadata=full which will cause the response to provide you with a navigation link (stored in the [email protected] property) to the files of your Group which is less error-prone than constructing it yourself.
2. Get Group's files
Execute a GET request to the URL returned by the [email protected] property in the previous request. Append /root to that URL:
GET https://graph.microsoft.com/beta/contoso.onmicrosoft.com/groups/14cb9281-5d0c-4bfa-99da-1eef714c2d2b/drive/root Authorization: Bearer xyz Accept: application/json;odata.metadata=none
The URL of the library where your Group files are stored is returned in the webUrl property.
Why would you need the URL of the library where your Group files are stored?
The new Group Files API abstracts the storage location of Group’s files and allows us to easily interact with folders and files stored in a Group. Still there might be scenarios where you might want to know where your Group's files are stored.
Providing your users with a direct access to Group's files
Currently, if you are in Outlook on the web and navigate to a Group, you will be redirected to Group's conversation first. From there you can navigate to Group's files. Knowing where these files are stored, you could build a solution that allows your users to navigate directly to Group's files.
Integrating with the Office Graph
The Office 365 Unified API offers two endpoints to interact with the Office Graph. Unfortunately these endpoints offer access to only the most basic information and if you want to build truly powerful solutions using the Office Graph, you would need to query the Office Graph using the SharePoint Search API instead.
If you were for example interested in files trending in a Group you would need to know where these files are stored to narrow down your Search and Office Graph query. You can do this using the URL of the library where your Group's files are stored.
Recently Microsoft updated the Group Files API. One of the improvements is the ability to easily get the URL of the library where your Group's files are stored. Being able to get that URL opens up many opportunities for building powerful productivity solutions on Office 365.