Call IModelDoc2::Access3rdPartyStorageStore extension method to access the 3rd storage store. Pass the boolean parameter to read or write stream.

Reading data

IThirdPartyStoreHandler::Storage property returns null for the storage which not exists on reading.

public override void OnLoadFromStorageStore()
{
    using (var storageHandler = Model.Access3rdPartyStorageStore(STORAGE_NAME, false))
    {
        if (storageHandler.Storage != null)
        {
            using (var str = storageHandler.Storage.TryOpenStream(STREAM_NAME, false))
            {
                var xmlSer = new XmlSerializer(typeof(RevData));
                var data = xmlSer.Deserialize(str) as RevData;
            }
        }
    }
}

Writing data

IThirdPartyStoreHandler::Storage will always return the pointer to the storage (stream is automatically created if it doesn’t exist).

public override void OnSaveToStorageStore()
{
    using (var storageHandler = Model.Access3rdPartyStorageStore(STORAGE_NAME, true))
    {
        using (var subStorage = storageHandler.Storage.TryOpenStorage(SUB_STORAGE_NAME, true))
        {
            using (var str = subStorage.TryOpenStreamSTREAM_NAME, true))
            {
                var buffer = Encoding.UTF8.GetBytes(DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"));
                str.Write(buffer, 0, buffer.Length);
            }
        }
    }
}

Explore the methods of IComStorage for information of how to create sub streams or sub storages and enumerate the existing elements.