Export webpart configuration as xml from sharepoint content database
-
11-12-2020 - |
Pergunta
I would like to programatically(C#) export all properties of all my webparts from Sharepoint 2013. I have access to SP content db and I wonder whether it is possible make use of it somehow (for example deserializing [tp_AllUsersProperties]
column).
I know I can do it by creating each webpart and reading its properties but it can be a long process.
I did some research and I found that there is (but unfortunately internal) class BinaryWebPartDeserializer
. (https://pholpar.wordpress.com/2010/10/17/decoding-the-content-of-the-binaryserializedwebpart-the-theory/)
I also found this post: https://zetitle.wordpress.com/2010/08/25/how-to-read-webpart-properties-from-the-database/ but it looks far too easy. I would rather prefer to use some SP API.
Do you know any reliable idea? Anything you can recommend?
Szymon
Solução
There is nothing reliable when querying a SharePoint content database directly, but if you are doing that then run your queries with NOLOCK
or READUNCOMMITTED
to prevent locking.