The System.IO.Packaging namespace contains public StorageInfo and StreamInfo classes that encapsulate OLE structured storage access. Unfortunately, the StorageRoot class, which is needed to create or open the files, is an internal class. However, you can use reflection to access the methods on StorageRoot if necessary. The code below will open a storage file and convert it to XML where each stream is hex encoded.
public static void ReadOSSFile(string fileName, XmlWriter writer)
int checkResult = StgIsStorageFile(fileName);
Preconditions.RequireArgument(checkResult == 0,
"The specified file is not an OLE Structured Storage file.");
private static object InvokeStorageRootMethod(StorageInfo storageRoot, string methodName, params object methodArgs)
//We need the StorageRoot class to directly open an OSS file. Unfortunately, it's internal.
//So we'll have to use Reflection to access it. This code was inspired by:
//Note: In early WinFX CTPs the StorageRoot class was public because it was documented