Hi, I want a macro that unarchives a bunch of messages from symantec enterprise vault. I found the following code on the internet but it doesn't work. The selected emails get copied to the "Export" folder but they're still just a stub. Any idea how to make it work?
Sub UnarchiveToExportFolder()
itemstoprocess = Outlook.ActiveExplorer.Selection.Count
itemsmoved = 0
If vbNo = MsgBox(itemstoprocess & " to process, do you want to proceed?", vbYesNo) Then GoTo theEnd
Set myNameSpace = Application.GetNamespace("MAPI")
Set myinbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myDestFolder = myinbox.Folders("Export")
For Each olkMsg In Outlook.ActiveExplorer.Selection
archive = (InStr(1, olkMsg.MessageClass, "IPM.Note", vbTextCompare) > 0)
If archive Then
olkMsg.Display
Set myInspectors = Outlook.Application.ActiveInspector.CurrentItem
Set myCopiedInspectors = myInspectors.Copy
myCopiedInspectors.Move myDestFolder
myInspectors.Close olDiscard
Set myCopiedInspectors = Nothing
itemsmoved = itemsmoved + 1
End If
Next
Set olkMsg = Nothing
Set myNameSpace = Nothing
Set myinbox = Nothing
Set myDestFolder = Nothing
theEnd:
MsgBox ("Finished, items moved " & itemsmoved & ", items not moved " & itemstoprocess - itemsmoved & ".")
End Sub
Sub UnarchiveToExportFolder()
itemstoprocess = Outlook.ActiveExplorer.Selection.Count
itemsmoved = 0
If vbNo = MsgBox(itemstoprocess & " to process, do you want to proceed?", vbYesNo) Then GoTo theEnd
Set myNameSpace = Application.GetNamespace("MAPI")
Set myinbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myDestFolder = myinbox.Folders("Export")
For Each olkMsg In Outlook.ActiveExplorer.Selection
archive = (InStr(1, olkMsg.MessageClass, "IPM.Note", vbTextCompare) > 0)
If archive Then
olkMsg.Display
Set myInspectors = Outlook.Application.ActiveInspector.CurrentItem
Set myCopiedInspectors = myInspectors.Copy
myCopiedInspectors.Move myDestFolder
myInspectors.Close olDiscard
Set myCopiedInspectors = Nothing
itemsmoved = itemsmoved + 1
End If
Next
Set olkMsg = Nothing
Set myNameSpace = Nothing
Set myinbox = Nothing
Set myDestFolder = Nothing
theEnd:
MsgBox ("Finished, items moved " & itemsmoved & ", items not moved " & itemstoprocess - itemsmoved & ".")
End Sub