Copy a Mailitem to public folder after being sent

G

Guest

Hi,

As the subject shows, I need to copy a mailitem to a public folder after the
mailitem has been sent.

Right now I use the mailitem.Write event to trap the send button. But when I
copy the mailitem to the public folder from this event, the copied mailitem
recieves "not sent" status and no senderemailaddress. And since Sent and
senderemailaddress is ReadOnly, I can't update them.

Could someone please help me with this problem. (Is there another event I
could use)

Best regards /Niclas
 
S

Sue Mosher [MVP-Outlook]

The easiest approach would be to use the Send event and add the folder's email address as a Bcc. Check with the Exchange administrator about mail-enabling the folder.
 
G

Guest

Hi Sue,

thanks for your reply.

I agree that sending the mail with Bcc to the folder would be the easiest
approach.
The problem is that the client I'm working towards has all their clients in
a unique public folder. And subfolders (projects) to the unique client
folder.

The way I'm trying at the moment is by listening to new items in the Sent
Folder.
But I'm not able to trap the event. Following is code that I use in my
ThisAddIn_Startup():

Dim sentMail As Outlook.MAPIFolder =
Me.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail)
Dim sendMailItems As Outlook.Items

sendMailItems = sentMail.Items
AddHandler sendMailItems.ItemAdd, AddressOf SentMailFolder_ItemAdd

with the sub:

Private Sub SentMailFolder_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
MsgBox("SentItems received...")
End If

End Sub

But the event doesnt trigger the msgbox to appear.

(If I can trap the event for adding Items to the sent mail folder I'll be
able to copy/move the sent mailitem to the correct public folder)

Any advice?

Best Regards /Niclas
 
D

Dmitry Streblechenko

Use the MAPIFolder.Items.ItemAdd event (where MAPIFolder points to the Sent
Items folder) - it will fire after the message is sent and the copy in the
Sent Items folder will be in the sent state.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top