More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

forum 06-Sep-2010 21:17

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

    Page [ 1 ]  
 Outlook Expert Techniques Printer Friendly Version
Working with toolbars, menus, ribbon; generating custom reports; deploying forms; connecting to databases, Exchange folders, and XML Web services
Topic
Moving Sent Items - problem when email is encrypted
Hi Sue

I have the following in my Outlook 2003 addin. The intention is to move emails sent from a shared email address to the Sent Items folder of the shared email and not the default Sent Items folder. (The GetFolder function is yours)

I have a problem when the email is encrypted. It of course errors when checking the SenderName. Is there any work around where a user manually sends an email from this second account and it is encrypted?

More specifically my addin can be used to send these emails as well so can I "Mark" this email somehow to know that it is encrypted.

The only thing I can think of is that at the time of sending to accept the next encrypted item that comes into the Sent Items as the email.


Set olSentItems = OlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items


Private Sub olSentItems_ItemAdd(ByVal Item As Object)


    Dim olFolder As Outlook.MAPIFolder
    If Item.Class = 43 Then
        
        If Item.SenderName = "MAILBOX NAME" Then
            
            Set olFolder = GetFolder("Mailbox - NAME\Sent Items")
            
            If TypeName(olFolder) = "Nothing" Then
                Set olFolder = GetFolder("Postfach - NAME\Sent Items")
            End If
            
            If TypeName(olFolder) <> "Nothing" Then
                Item.Move olFolder
            End If
        End If
    End If
    
    Set olFolder = Nothing


End Sub

  27-Jul-2010  07:33
  27-Jul-2010  07:47   
You're not going to be able to access any information in an encrypted message, so I don't see how you're going to know which mailbox to copy the item to.
  27-Jul-2010  09:00   
I tried to say that if my addin sends an encrypted email then move it. But you cannot even move an encrypted email.

So that is it - no go.

Thanks Sue
  27-Jul-2010  09:26   
That sort of makes sense. If an encrypted message is moved, it probably loses the connection to the certificate used for the encryption, so it wouldn't be readable.
  27-Jul-2010  09:50   
Just for anyone finding this thread. I have a listener which checks the default sent items folder. When an encrypted item hits this folder there is nothing you can do with it. You cannot read a property and you cannot move it.

Your only option is to intercept the mailobject when you send it. At that stage you can still move - "a copy of the email" (I think) to another folder. The only thing is that during the event of send there are also no properties available.

So You would need to let your little addin in know that the next sent email should be moved and then move it.

I gave up. And just got annoyed that 2003 does not move my non-default emails to the sent items folder of that mailbox.
    Page [ 1 ]  
Post a new message to this topic.



name        email