Freelance Cloud Architect
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Web.UI.WebControls;
namespace WebPartLister
{
public class WebPartLister : System.Web.UI.WebControls.WebParts.WebPart
{
BulletedList list;
protected override void CreateChildControls()
{
list = new BulletedList();
WebPartZoneCollection zones = this.WebPartManager.Zones;
foreach (WebPartZone zone in zones)
{
WebPartCollection webparts = zone.WebParts;
foreach (WebPart webpart in webparts)
{
list.Items.Add(
string.Format(“{0} ({1}), {2}”,
webpart.Title, webpart.GetType().Name,
zone.DisplayTitle));
}
}
this.Controls.Add(list);
}
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
list.RenderControl(writer);
}
}
}
Here’s a list of completely awesome tutorials on how to use PowerShell to control the Sharepoint API:
Cross posting from Andrew Connell for later reference:
Announcing three CodePlex projects for community WCM code samples
Cross posted on Spencer Harbar’s Blog.
We (Andrew Connell & Spencer Harbar) would like to announce three new CodePlex projects created to enable the community to share examples of useful Publishing site elements built using the Web Content Management features of Office SharePoint Server 2007. Initially these projects contain a number of commonly used MCMS 2002 Placeholder controls converted for use within MOSS Publishing sites which have been graciously donated by Microsoft. Over time these samples will be augmented and enhanced. Future plans include the consolidation and alignment of deployment mechanisms of all code samples in all projects.
All the CodePlex projects listed below are released under the most permissive Microsoft license (Ms-PL) which means that you can do virtually anything you want with these code samples.
Many of the code samples include a MS Word document explaining the process of developing the code sample as well as deployment instructions.
The projects (and the included code samples) are broken down as follows:
SharePoint 2007 WCM Field Controls
A collection of sample Field Controls for use within Publishing Sites built using Office SharePoint Server 2007’s Web Content Management features.
SharePoint 2007 WCM Web Parts
A collection of sample Web Parts for use within Publishing Sites built using Office SharePoint Server 2007’s Web Content Management features.
SharePoint 2007 WCM Utilities
A collection of useful utilities for Publishing Sites built using Office SharePoint Server 2007’s Web Content Management features.
© 2024 Peter Birkholm-Buch
Tema af Anders Noren — Op ↑