1

I developed a webpart to return all the site collections and webs that a user has read access to; I want to limit the results to Team sites only.

How can I accomplish this? I've looked through the applicable attributes, but am unable to determine which one will only return team sites.

Any help is appreciated.

Thank you.

1 Answer 1

1

The following properties of SPWeb could be used to determine the site template(definition):

  • WebTemplate - the name of the site definition or site template that was used to create the site
  • WebTemplateId - the identifier (ID) of the site definition that was used to create the site
  • Configuration - the identifier (ID) of the site definition configuration that was used to create the site, or the ID of the site definition configuration from which the site template used to create the site was derived

Example

The following method is used to determine if site is Team Site:

private static bool IsTeamSite(SPWeb web)
{
     return (web.WebTemplate.Equals("STS",StringComparison.InvariantCultureIgnoreCase) && web.WebTemplateId == 1 && web.Configuration == 0);
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.