Hi all,
I have a web part that renders metadata from items in the Pages library. It
is used only on publishing pages.
I want to perform a check in the code behind to first verify the current
web is publishing enabled.
// Get Web and check for Publishing feature enabled
SPWeb web = SPContext.Current.Web;
if (PublishingWeb.IsPublishingWeb(web))
{
//Render web part contents
}
else
{
_html.Append("Not a publishing web.").AppendLine();
}
This is returning false within my publishing site(s). :\
Is there a better way to check this?
I then want to confirm that the current item is within the page's library.
// Get the publishing Pages library
String pagelib = PublishingWeb.GetPagesListName(web);
// Get current item's list
SPList pages = SPContext.Current.ListItem.ParentList;
// Ensure current library is pages lib
if (pages.Title == pagelib)
{
Again, is there a better way to get this info?
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss