I have been working with the new Office 365 Groups feature a little bit and I wanted to see how I could surface them from a regular SharePoint Online site. In my example today, I have created two public groups and three private groups.
My first thought was to use Search. Ultimately, I knew the file storage behind groups was powered by a site collection. I just need to figure out which WebTemplate was being used. You can see the name of the site collection fairly easily by looking at one of the documents in search. It’s simply stored at /sites/<GroupID>. You can see your Group ID when creating the group initially.
Using the REST API, we can then just assemble the URL with /_api/web onto the existing URL such as https://tenant.sharepoint.com/sites/GroupID/_api/web. Looking through these results I found out that the WebTemplate for the site is simply named GROUP. Now that we have this, we can query search using the WebTemplate managed property. The query we want is simply:
You can type this directly into the keyword textbox in your Search Center.
Now wait a minute. I am in five groups but it’s only showing me two. After doing some research and some additional queries, I discovered that no matter what I did, search could never find private groups or the documents within them. I am not sure if this is a bug or it is intentional, but as of right now you can only see public Groups with search. Still this might be valuable to you, so you could always use this query inside the Content Search web part.
I am hoping that we can query private groups as well in the future, but it’s still nice to be able to query your groups if you use a lot of public ones.