SharePoint issue using feature with AllUsersWebPart node
I have a SharePoint function that sets up a new page layout.
The requirement for this feature was to set the page layout using the default web part so that when the user takes the Create Page action, the page will be created with the web part already on the page.
So I tried to add the AllUsersWebPart node to the page element definition, eg.
<Elements>
...
<Module ...>
...
<File ...>
<AllUsersWebPart ...>
...
</AllUsersWebPart>
</File>
...
</Module>
</Elements>
Installed, deployed the function, etc., and of course got the helpful error "No parameters, no parameters for this object" - most likely a problem with my definition in the .xml element.
Now I have a REAL problem: I tried to remove the AllUsersWebPart section from the function definition (so that the page does not create web parts when it is created), and due to a fantastic bug in SharePoint, the web part is still defined for the page layout. although the function definition says differently - I found some details about it at http://sharepointblog.buus-oestergaard.dk/post/Default-webparts-in-sharepoint-pagelayouts.aspx (Point # 2).
I've tried updating and removing / reinstalling this feature, but has no effect - how can I remove this web part from the function / db content so that I can just set the page layout or put the correct web part definition in the function?
a source to share
Ok I got the page layout, these are the steps I took in case it is helpful:
1 Edit the page layout in the page serving mode of the web part:
http://<server name>/_catalogs/masterpage/<page name>.aspx?contents=1
Remove all instances of the web parts.
2 Open the layout (on the server) in Designer and make sure the WebPartZone / ZoneTemplate s is empty. Make sure the page layout is set to approve after checking this.
The page layout can be used after that - I was able to uninstall and reinstall the page layouts without any problems.
It looks like the web part definitions remain in the database, so when the function is updated / reinstalled they are already bound to the page / web part zone. The sorting of this should probably be done in code in the receiver function in the page layout function, if I ever write about this, I'll post it somewhere ...
a source to share