Set default page for SharePoint publishing site

Here is a function that will set the default page for a publishing site.

Just pass in your web and the new default page name, it will take care of the rest.
Works great when creating new sites.

public static void SetPageAsDefault(SPWeb web, String pageName)
{

if (PublishingWeb.IsPublishingWeb(web))
{

PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);

SPFile welcomefile = web.GetFile(pageName);
if (null != welcomefile)
{
publishingWeb.DefaultPage = welcomefile;
publishingWeb.Update();
}
}

}

SharePoint set custom masterpage on site

Here is a function that will set a site (including sub sites) to use a custom masterpage.

You pass in the masterpage, web, and if you want to include sub sites (it will call itself with the sub site name).

public static void SetCustomMasterPage(string masterPage, SPWeb web, bool includeSubSites)
{
web.CustomMasterUrl = GetMasterPageUrl(masterPage);
web.Update();

if (includeSubSites)
{
foreach (SPWeb child in web.Webs)
{
SetCustomMasterPage(masterPage, child, true);
child.Dispose();
}
}
}

 

Set custom master page

When using a custom master page with SharePoint you need to set all your sub sites to use the same master page.

Here is a function that will recursively change the master page for all sub sites.
Just call if from you feature receiver passing in the master page, the web you want to start with, and if you want to include sub sites.

/// <summary>
/// Sets the custom master page URL for the site.
/// </summary>
/// <param name=”masterPage”>Master page name.</param>
/// <param name=”web”>Site that you want to set the mater page.</param>
/// <param name=”includeSubSites”>Allows you to set all sub-sites as   well.</param>
public static void SetCustomMasterPage(string masterPage, SPWeb web, bool includeSubSites)
{
web.CustomMasterUrl = GetMasterPageUrl(masterPage);
web.Update();

if (includeSubSites)
{
foreach (SPWeb child in web.Webs)
{
SetCustomMasterPage(masterPage, child, true);
child.Dispose();
}
}
}

Delete a Performance Point 2007 Cycle

So I have been doing a PPS proof of concept and I have created cycles (I am not going to explain what a cycle is) that I no longer want (or need).  So I wanted to delete some cycles and found it not easy to figure out.

So here are the short instructions:
In the Workspace Browser, click Process Management, then select the cycle you want to delete.  In the cycle tasks pane, click Available Actions in the Select Action list, then select Close.  Then repeat and select Purge from the Select Action list.  After you click ok all the assignments and jobs are deleted.

Now the problem is that the cycles are still there??? And you can no longer go to the Available Actions.

Here’s that one trick you have to remember, the Business Modeler has to be refreshed so click the refresh model site arrows icon (or press F5 or View->Refresh or close and reopen).

Yeah this took me a while to figure why the cycle still showed up after supposedly getting rid of them.  The moral of the story is always remember the Planning Business Modeler sometimes automatically and sometimes it doesn’t so ALAWYS click the refresh buttons.