Sep 19, 2009

To get the welcome page of the publishing site programmatically

Objective is to get the handle of the welcome of the site.

This will work for collaboration portal

PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(SPContext.Current.Web);

SPFile welcomePage = publishingWeb.DefaultPage;

bool isWelcomePage = false;

if (welcomePage != null)

{

string welcomeUrl = welcomePage.ServerRelativeUrl.ToString();

}

This way we get the welcome of the current publishing site.

Enjoy!!!

No comments:

Post a Comment