3

I am looking for a way to show/list all the teamsites on my SharePoint 2013 Foundation site. And if i click on the name, i have to redirected to the actual teamsite.

How can i realise this, so that everyone on the site can view all the teamsites? I don't mind if it's build with Javascript or Powershell, just needs to work.

In forward, many thanks!

2

Another option would be to use search and query for all sites with a given template:

"WebTemplate:STS"

Then you get everything else for free (clickable links, security trimming, etc.)

| improve this answer | |
  • Thanks! I managed it by this query: (contentclass:"STS_Web") – BassieBas1987 Nov 12 '13 at 8:23
0

You can iterate through each of your webapplication and then check it for Teamsite. Create a datasource and bind it to Grid or any control.

Ex:

using (SPWeb web = site.OpenWeb("/"))  
{     
   string templateID = web.WebTemplateId.ToString();
   if(templateID=="STS#0")
    //process
} 
| improve this answer | |
0

In PowerShell you can use something like this

Get-SPSite | Get-SPWeb | ? { $_.WebTemplate -match "STS"} 

However PowerShell can not be used inside a Site collection

I think the best way is to use Search for this.

| improve this answer | |
  • Thanks, but how can i show these links on my SharePoint page, so that the users can click on those links? – BassieBas1987 Nov 11 '13 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.