How to read a “tCompressedString(varbinary(max))” fieldvalue from a SharePoint content database


this blog helped me to find the solution:

http://blog.cloudsiders.com/2010/02/sharepoint-2007-vs-2010-how-do-my-list-content-types-policies-customxsn-look-like/comment-page-1/#comment-59

a snippet from my code:

using System.IO.Compression;

SqlBytes bytes = sqlDataReader.GetSqlBytes(sqlDataReader.GetOrdinal(“xmlFields”));
Stream stream = bytes.Stream;
for (int i = 0; i < 14; i++)
                stream.ReadByte();
DeflateStream deflateStream = new DeflateStream(stream, CompressionMode.Decompress, true);
StreamReader reader = new StreamReader(deflateStream);
string fields = reader.ReadToEnd();

Advertisements
This entry was posted in Geen categorie and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s