7/06/2015

Using SharePoint Search To Find Sites You Have Access To


Did you ever wonder if there's more to SharePoint? Sites you may have permissions to, but no one ever told you about? Sites like the rumored jokes site and the "free stuff" site? You can use search to find these sites!
ContentClass is a SharePoint 2013 Managed Property that is used to find many SharePoint things by their "type". Two ContentClass values of interest when searching for sites are "STS_Site" and "STS_Web".
Tip: For more on what you can do with ContentClass see SharePoint Power Searching Using ContentClass and also here: http://techtrainingnotes.blogspot.com/2015/02/sharepoint-2013-list-and-library.html

STS_Site

The STS_Site property is used to find site collections, or actually just find the top level sites of site collections. To list all of the top level sites that you have permissions to see, search for "ContentClass:STS_Site". (See warning below!)
image
My test user Sam found 8 site collections and my administrator account found 38.

STS_Web

The STS_Web property is used to find subsites. To list all of the subsites that you have permissions to see, search for "ContentClass:STS_Site". (See warning below!)
image
Sam found 9 subsites while my administrator account found 158.

Find all sites you have access to…

Just combine both searches with an "OR" to show all of the sites you have access to. (Remember that Boolean operators like AND, OR and NOT must be in UPPER case.)
image

Adding Keywords

A little tip: If you add keyword to your STS_Web and STS_Site queries you will not be searching content in the site. You instead will be searching for that keyword as a property of the home page or content that might be displayed on the home page. The following search will only return results when "plane" in somewhere on the home page of the site:
image

Warn'n matey, here be dragons, or at least duplicates…

SharePoint 2013 search hides duplicates by default and treats many of the things returned by STS_Site and STS_Web as duplicates. Over half of my subsites are missing using an out of the box search! Administrators can fix this little issue by following the "Option 2" steps here: http://techtrainingnotes.blogspot.com/2015/04/sharepoint-2013-search-weirdness-part-1.html.

STS_Site <> SPSite

A note to developers and administrators: SPS_Site is not the same as SPSite. It's actually finding SPWebs, but only finding those that are top level webs.

.

5 comments:

Elaina Cherry said...

This page just solved a problem I was having and probably saved hours of experimenting or googling. Thank you!

Kevin said...

Thanks, just what I needed.

K

Anonymous said...

I have a similar but opposite problem.
We have a bunch of sharepoint sites that various people including external users have access to.

I would like to be able to get a list of all the sites that a specific person has access to so I can remove their access from some or all the sites?

Mike Smith said...

Anonymous,

That's doable, but not with search. You can write a PowerShell script to do this, but it is a bit busy as it has to check each site for UserA, each SharePoint group that hass access to any content in the site for UserA and each Active Directory group that hass access to any content in the site for UserA.

Are you working with an on-prem SharePoint farm or Office 365? Are you a farm or tenant administrator?

Mike

Anonymous said...

It is hosted, not on-prem.
I'm not the adminstrator. She isn't really a sharepoint expert. Neither am I:-(
I've just been tasked to look into radically expanding our use of sharepoint for collaboration with external users, and being able to manage and specifically remove people's access if the relationship ends naturally, or is terminated.

Up until now the approach has to give them AD accounts in our system, which we can delete. However that gets unwieldy as we expand to more external users. It also doesn't allow fine grained control or a view into what they can see. Its all or nothing, big hammer approach.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.