on 10-01-2014 8:41 AM
Hi all ,
I want to save into a table an outlook message as file ( the file's path) , how do i do that quick and easy for the user ?
(my table saves all kind of files , path + file name and opens it with the according program )
working with pb 12.5 classic with sqlanywhere 11 , MsSql.
Thanks
Moshe
There is a SaveAs method you can use when interacting with Outlook via OLE.
SaveAs Method [Outlook 2007 Developer Reference]
I have an example that uses OLE to interact with Outlook. It doesn't do a SaveAs but it does have an example of using the Delete method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To use the SaveAs, you first need the following constants:
// OlSaveAsType Enumeration
Constant Integer olDoc = 4
Constant Integer olHTML = 5
Constant Integer olICal = 8
Constant Integer olMHTML = 10
Constant Integer olMSG = 3
Constant Integer olMSGUnicode = 9
Constant Integer olRTF = 1
Constant Integer olTemplate = 2
Constant Integer olTXT = 0
Constant Integer olVCal = 7
Constant Integer olVCard = 6
The function call would look like this:
oleMailItem.SaveAs(ls_filename, olMSG)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I reworked my example and included a SaveAs button and a Print button.
It now connects to Outlook in the application open event and disconnects in the application close event. Before it connected/disconnect in each button.
If you mean saving the message as a blob into the database, you will need to do as Roland suggested and save the email to disk first and then stream the file in as a blob to store it into the database.
Something like this to read the file from the disk
li_fnum = FileOpen(as_filename, StreamMode!)
if li_fnum < 0 then
Messagebox('Error opening file in Stream Mode', 'File: ' + as_filename, exclamation!)
return li_fnum
end if
ll_bytes = FileReadEx(li_fnum, ablb_fileimage)
FileClose(li_fnum)
To view the file, you will need to do the reverse before you can launch the MSG file to view the message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.