Currently our users are uploading access db files with extension .mdb into Tridion 2013 as multimedia components and publishing it to file system. We are trying to do a POC to redesign various approaches with minimal affect to the existing procedures followed.
So the requirement is to read the mdb file from multimedia component and generate simple json of the all the values found. So, I tried reading the binarycontent aka mdb file but no luck in the .Net assembly TBB.
Here is the snippet used in the TBB.
Component component = engine.GetObject(componentItem) as Component;
if (component.ComponentType.ToString().Contains("Multimedia"))
{
MemoryStream ms = new MemoryStream();
BinaryContent binary = component.BinaryContent;
binary.WriteToStream(ms);
FileStream file = new FileStream("test.mdb", FileMode.Create, FileAccess.Write);
ms.WriteTo(file);
file.Close();
ms.Close();
}
I want to access the access db (.mdb) file in TBB using OLEDB or something similar for which i need the local or physical file. So, I couldn't figure a way to do the same. Is it really possible? Thanks.
MemoryStream.WriteTo
resets the stream location before writing.