unarchive email from enterprise vault

Status
Not open for further replies.

Shane247

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
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
 

Shane247

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
If I open the email in the first folder it doesn't show me the full email but if I copy the email to another folder, then open it in its own window , it automatically fetches the content from the enterprise vault and then shows me the full email. If I run the above macro on the copied email it still doesn't work though. Is there any way to copy or move (or send to OneNote) the currently open email - is that what the code above is trying to do by calling olkMsg.Display? Maybe I need a delay after calling olkMsg.Display ?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Do you want to move all selected emails to another folder? If so, try this
Code:
dim item as object,sel as outlook.selection, i as long
...
set sel=application.activeexplorer.selection
for i=sel.count to 1 step -1
  set item=sel(i)
  ...
  if archive then
    item.move mydestfolder
    ...
  endif
next
 
Status
Not open for further replies.
Top