I have save a sqlite file bij using “SaveAsDialog”.
Now i like to send a automatically Email with this file as a attachment.
I have used the following code: And send the Mail to my onw adres, but i receive a Email with a empty attachment . What’s is wrong?
Dim dialog As SaveAsDialog
Dim file As FolderItem
dialog = New saveAsDialog
file = dialog.ShowModal
Dim DBase As New SQLiteDatabase
MailFile = New EmailAttachment
You redacted the code that writes the database file.
It could either be your method of writing the database isn’t working, or something to do with your GetFolderItem of a folderitem’s shellpath mess.
If your only goal is to mail the database, you don’t need to offer a SaveAsDialog. You can just write it to temporary.
I like to write it in some Folder (up to the customer) and send it allso with a Email as a ordering.
I don’t no how to write it to temporary, maybe thas a better way.
Instead of making the FolderItem with a SaveDialog, you would use SpecialFolder.Temporary
It might actually be a better way to do this in your case. Write the database to the temporary, ask the user if/where they would like to save it, and then email it from the temporary folder just in case they cancel instead of saving.
A sample workflow might be
[code]dim TemporaryDatabaseFile as FolderItem = GetTemporaryFolderItem
// Write the database to the TemporaryDatabaseFile
// SaveAsDialog goes here
// Copy TemporaryDatabaseFile to FolderItem returned from SaveAsDialog
dim MailFile as EmailAttachment = new EmailAttachment
MailFile.LoadFromFile(TemporaryDatabaseFile) // this is how it really should be done because you already have a FolderItem, you don’t need to GetFolderItem of a FolderItem ShellPath - that’s asking for trouble where none needs to exist.
// The rest of your mail code