I want to show some of the sub sites in a web part of main site. I have 10 sub sites of which 4 of them are work-space sites. I want to show all the work-space sites on the main site in a web part. I tried to use table of contents but it shows all the sub sites belonging to the site. I want only my required sites to be shown in web part as links . Can some one suggest on how to approach this in SharePoint 2010. thanks in advance.
-
What identifies the required sites? If there is nothing special or "automatic" here you could just use Summary links webpart and add the links manually– Robert LindgrenCommented Aug 11, 2015 at 18:22
-
@robert lindgren whenever we create a workspace site the link should be populated at the web part which cannot be done through summary links.– SPLearnerCommented Aug 11, 2015 at 18:24
Add a comment
|
1 Answer
you can try the following code snippet and use it in a custom webpart/visual web part to filter and display the links of the specific template based sub sites.
using Microsoft.SharePoint;
using Microsoft.SharePoint.Meetings;
public void DisplayLinks()
{
using (SPSite site = new SPSite("http://sitecollectionrul"))
{
using (SPWeb web = site.OpenWeb("subsitename"))
{
//// IsMeetingWorkspaceWeb Method is used to determine whether the specified Web site was created by using a Meeting Workspace template
if (SPMeeting.IsMeetingWorkspaceWeb(web))
{
add your logic to display the links here
}
else
{
}
}
}
}
}
}
-
I cannot use server side coding in our environment. Thnaks for the snippet though . Commented Aug 12, 2015 at 14:12