Programmatically Enumerating Publish Page Layout Web Part Areas

I have a situation where the class I have is an instance of PublishingPage, and I want to list all and all the zones of the web parts that are used on the layout page for this page.

It's complicated.

PublishingPage has a Layout property, which is of type PageLayout. This is different from PublishingLayoutPage, which inherits (ultimately) a page that has the Zones property. This PageLayout type does not have a reference to the regular ASP.NET page type, which has the Zones property that I need.

I can get SPListItem and SPFile from the PublishingPage.Layout property and get the contents of the page layout in text form, but this cannot be parsed using XmlReader, because it is not valid XML (has <% tags that are not valid).

I can get SPWeb from PublishingPage.ListItem.Web, and it can get me SPLimitedWebPartManager, where I can get the LimitedWebParts collection (which has zone information), but that won't help, because at this point in my code I don't have any web parts .

I'm pretty stuck, it looks like the publishing infrastructure is pretty separate from ASP.NET and SharePoint.

UPDATE:

SPLimitedWebPartManager - (, ContentEditorWebPart) - ( , ), ( SPLWPM), WebParts, Zone null ( ZoneID ).

+5
1

Wayne Fan , , , . , .

0

All Articles