As discussed in my previous post, each group is underpinned by a separate site collection in SharePoint Online. When you upload a document to a group, it gets uploaded in the "Documents" library of the root web of that site collection. So you can use the REST API to get all sorts of information about the group including the list of documents.
Here is a test group called "Technical Team" I have created in Office 365 for the purpose of this post. I have also uploaded 2 documents to it:
In order to get the list of documents in the group, we need to make a REST call to the SharePoint Search REST API:
_api/search/query?querytext='SiteTitle:"Technical Team" AND ContentTypeId:0x0101007DB6FD427B6228409ED888DF766B27C9'&selectproperties='Title,Path,SiteTitle'
The ContentTypeId is the id of the content type which is associated to the document when a document is uploaded to an Office 365 group.
And the logs in my Dev tools console:
Thanks for reading!
Post a Comment