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?
Printable View
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?
Welcome to VBAX. This issue comes up regularly. What code have you been trying?
To move encrypted emails, use the Copy and Delete methods instead of Move. Here’s a quick code example:
Replace "YourTargetFolder" with your actual target folder name.Code: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
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?