I want to save the properties of web part somewhere in Xml/Xslt, So that if i remove a web part and then, again add it. previous properties will be retrieved automatically into the web part.
For custom web parts it is pretty easy. You have to override the
OnPreRender event and then read or write an XML document (standard c#, no magic).
For out-of-the-box web parts it is a really difficult as there doesn't exist functionality in the SSOM which supports this universally.
To do this with out-of-the-box web parts you'd have to do 1 of 2 things:
- If you are on a SharePoint Enterprise, you'd have to create custom pagelayouts which has a codebehind that loops through all web parts present in the
- Create a UserControl which gets loaded onto every page by a delegate control, which then loops through all web parts present in the
Besides the 2 points above, you'd have to make a class which not only reads all properties from an XML file, but also creates and populates all properties to a XML file. Keep in mind though that you will need to have some way to identify every individual web part. Saving properties for just a
ContentEditorWebPart is not good enough as you can have multiple of those one a single page and each can have their own settings.
I am tempted to say that doing this for out-of-the-box web parts is impossible.