How could I find the fields of a SharePoint list from database in SharePoint 2010?

微笑、不失礼 提交于 2019-12-04 09:16:43

Just to share, I wrote the below method and it can now extract the xml from it although there is no quarantee the resulting xml is compatible with SharePoint 2003/2007.

 private static string getXmlFromTpFields(byte[] tpFields)
        {
            using (var memoryStream = new MemoryStream(tpFields))
            {
                // ignore the first 14 bytes; I'm not sure why but it works!
                for (var index = 0; index <= 13; index++)
                    memoryStream.ReadByte();

                var deflateStream = new DeflateStream(memoryStream, CompressionMode.Decompress);

                using (var destination = new MemoryStream())
                {
                    deflateStream.CopyTo(destination);

                    var streamReader = new StreamReader(destination);
                    destination.Position = 0;
                    return streamReader.ReadToEnd();
                }
            }
        }
Jd Barlow

I have been doing this for a long time and found a utility program named SPViews. You point it at the content database and it generates the SQL script to create the views for you. It reads the compressed field to get the columns and generates the script. You can get the columns from there.

jd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!