1

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.

1
  • 1
    Why do you use an intermediate MemoryStream (effectively loading the entire binary content in memory)? Why not write directly to the FileStream? I'm not sure if MemoryStream.WriteTo resets the stream location before writing. Apr 4, 2017 at 18:40

2 Answers 2

1

So far, are you able to save the mdb file while publishing the item? If not, are you getting any error while publishing?

1
  • I did not publish it yet. I am stuck in Template builder itself. It isn't giving me the actual mdb file that is uploaded in the multimedia component as I need to query it.
    – Guest19876
    Apr 4, 2017 at 15:34
0

Please try this Publish an Image to a Structure Group Mirroring Folder. i hope it will help for your problem.

1
  • Thank you but this didn't help. Maybe i need to update my question to be more precise.
    – Guest19876
    Apr 5, 2017 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.