I am working on a sort of app store, where a modaldialog pops up and shows a list of web parts that can be added to the page. The real issue is when I want to add a web part to the page; the AddWebPart method requires a ZoneID, but as far as I can tell there is absolutely no easy way to get access to the available zones on a page.
I came up with the following:
- Get the SPWebPartManager and go through its zones The SPWebPartManager requires a Web.UI.Page and I am in a modal dialog so I can't access it. Some sources speak of a .Parent property for the LimitedWebPartManager but that doesn't appear to be available in SP2010
- Read the html SharePoint has a style tag in the head which contains one line per web part zone. I can access this and extract the ids of the zones... BUT this gets me every zone. Not just the ones that are editable. For example, it also gives me the zone that contains the search box at the top of the page.
- Read the source of the page I would have to read in the .aspx page from the hive and regex my way through it. This would work, but frankly it's completely absurd to do this.