Consulting

Results 1 to 4 of 4

Thread: Code to move encrypted emails

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Code to move encrypted emails

    Hello guys,
    I want to move encrypted emails. But I find that the "object. move" function does not work on ecrypted emails. All suggestion about the right code?

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,259
    Location
    Welcome to VBAX. This issue comes up regularly. What code have you been trying?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Regular
    Joined
    Jun 2024
    Location
    US
    Posts
    8
    Location
    To move encrypted emails, use the Copy and Delete methods instead of Move. Here’s a quick code example:

    Sub MoveEncryptedEmails()
        Dim sourceFolder As Outlook.MAPIFolder
        Dim targetFolder As Outlook.MAPIFolder
        Dim item As Object
        Set sourceFolder = Application.Session.GetDefaultFolder(olFolderInbox)
        Set targetFolder = Application.Session.Folders("YourTargetFolder")
        For Each item In sourceFolder.Items
            If item.Class = olMail And item.PropertyAccessor.GetProperty("http://schemas.microsoft.com/ _
                mapi/proptag/0x7D01001E") = "IPM.Note.SMIME.MultipartSigned" Then
                item.Copy targetFolder
                item.Delete
            End If
        Next
    End Sub
    Replace "YourTargetFolder" with your actual target folder name.

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,259
    Location
    I have no experience with Outlook vba, so if I ever saw this string ("http://schemas.microsoft.com/ _
    mapi/proptag/0x7D01001E") = "IPM.Note.SMIME.MultipartSigned") used somewhere, does it indicate the email is definitely encrypted?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •