deltakilo
deltakilo

Reputation: 3

How to bulk export Attachments from emails (which are emails) to another folder within Outlook

I need to extract .msg attachments from emails in a range and save these into another outlook sub-folder. This works currently by dragging the attachment into a sub-folder of 'inbox' but is there a quicker way?

I have searched around a bit and found ways to extract them to a local folder but i need them to be contained within outlook.

I appreciate any help and suggestions.

Thanks.

Upvotes: 0

Views: 213

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66276

There are two problems here - first is accessing embedded message attachments without saving them first as MSG file. Second is importing the MSG files back - you can use Application.CreateItemFromTemplate, but the item will be unsent. You can use Namespace.OpenSharedItem, and then use MailItem.Move, but it is still a kludge.

There issn't much much you can do in OOM alone. Extended MAPI would work, but it is C++ or Delphi only. If using Redemption is an option (I am its author), you can use EmbeddeedMsg property exposed by the Redemption RDOAttachment object. You can also use RDOMail.CopyTo and pass a folder as a parameter to copy an embedded message attachment to a folder:

Set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set redItem = Session.GetMessageFromId(OutlookMessage.EntryID)
set redFolder = Session.GetFolderFromId(OutlookFolder.EntryID)
for each attach in redItem.Attachments
  if attach.Type = olEmbeddeditem Then
    attach.EmbeddedMsg.CopyTo OutlookFolder
  End If
next

Upvotes: 0

Related Questions