|
-
Jan 28th, 2003, 06:47 AM
#1
Thread Starter
Addicted Member
Programming MS outlook in VB.Net
An application creates Email message(s),
attaches one file for each message, save messages
into 'Draft' folder.
Private OutlookAppl As New Outlook.Application()
Private msg As Outlook.MailItem
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
msg = OutlookAppl.CreateItem
(Outlook.OlItemType.olMailItem)
With msg
.Body = "Body"
.Subject = "Subject"
.Attachments.Add("C:\aa\1.txt")
.Save()
End With
msg = Nothing
' OutlookAppl.Quit()
OutlookAppl = Nothing
End Sub
There are couple of problems:
1. When I am attaching several files, the very first
file saved in the 'Inbox' folder, but all the others
in 'Drafts' folder, although the code for all messages
completely identical:
msg = OutlookAppl.CreateItem
(Outlook.OlItemType.olMailItem)
With msg
.Body = "Body"
.Subject = "Subject"
.Attachments.Add("C:\aa\1.txt")
.Save()
End With
msg = Nothing
msg = OutlookAppl.CreateItem
(Outlook.OlItemType.olMailItem)
With msg
.Body = "Body"
.Subject = "2"
.Attachments.Add("C:\aa\1.txt")
.Save()
'.Close()
End With
msg = Nothing
msg = OutlookAppl.CreateItem
(Outlook.OlItemType.olMailItem)
With msg
.Body = "Body"
.Subject = "333"
.Attachments.Add("C:\aa\1.txt")
.Save()
'.Close()
End With
msg = Nothing
OutlookAppl = Nothing
It is completely unclear, why the very first message goes
into 'Inbox'.
2. I wrote a routine which enumerates messages in Inbox folder and all messages which have no recipient addresses will move into Drafts folder. But this leads to another issue: Outlook displays message that some program trying to access messages, stored in Outlook, if it is unexpected, it may be virus ... So it is necessary to check a CheckBox and click on “Yes” button. I do not want this message to be displayed each time, the app. runs, so I am using API to perform necessary actions, but anyway do someone knows how to turn off this protection message?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|