How can I get a file that is stored in a SQL database (Blob) to a Notes document?
Great timing!!! We just finished a project doing this exact thing earlier this week. Unfortunately, it's not that easy, nor straightforward to do. You can use the LC (or LEI) LSX to access the SQL table, get the column into an LCField object, and then store the contents to disk.
Here's some sample code:
myBlob = "C:\temp\tempfile.doc" Open myBlob For Binary As #1 Put #1 ,, lcField2.value(0) Close #1 ' now attach to the appropriate Notes document using a LotusScript RichTextItem EmbededObject
This example assumes the file, based on the extension, is a Word document and the filename does not really matter. Hopefully the SQL row will contain this information for you in one or more other fields, since I'm not sure if you can get that information from the attachment without [painfully] canning the binary contents of the file. In our case, we used a COM object that was written in Visual Basic to get the file from the BLOB column. The COM object was written to also convert the file from its native MS Word format to HTML using the Word-to-HTML conversion feature in MS Word 2000. Pretty slick, but it might be overkill for your needs.
Dig Deeper on Lotus Notes Domino Administration Tools
Related Q&A from Scott Lemieux
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.