将Outlook附件(即电子邮件本身)保存到Outlook中的另一个文件夹,可以这样做吗? [英] Save Outlook attachments (that are emails themselves) to another folder in Outlook, can this be done?

查看:421
本文介绍了将Outlook附件(即电子邮件本身)保存到Outlook中的另一个文件夹,可以这样做吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到很多关于如何将Outlook附件保存到桌面或网络上的文件夹的信息。 我需要在收件箱中从电子邮件中提取附件 并将它们移动到另一个子文件夹。 这些附件都是电子邮件,每天手动执行
非常累人,我想要一个可以运行的脚本或宏来拉取子文件夹中的所有附件。 此文件夹通常包含大约500封电子邮件,每封电子邮件至少附有一封电子邮件。 我需要
将所有附加的电子邮件汇总到一个文件夹中。


任何想法?


谢谢,


LJB

解决方案

您好,


如何移动这些附件  ; mailitem手动到一个文件夹?


您是否打开附加的mailitem然后转到文件 - >信息 - >移至文件夹 - >复制到文件夹?


您可以首先搜索带附件的所有项目,然后检查其附件是否是邮件项目,然后将其保存到本地并在Outlook中打开,然后您可以复制附加的mailitem在某个文件夹中。


下面的代码可以搜索收件箱并将所有附加的msg文件保存到收件箱的子文件夹中。

 Sub Demo()
Dim qry As String
Dim myInbox As Items
Dim myItems As Items
Dim myItem As Object
Dim myMailitem As MailItem
Dim att As Attachment
Dim path As String
Dim eml As MailItem
Dim myCopiedItem As MailItem
qry =" @ SQL =" &安培; Chr(34)& "瓮:模式:HTTP邮件:hasattachment" &安培; Chr(34)& "等于1英寸;
设置myInbox = Application.GetNamespace(" MAPI")。GetDefaultFolder(olFolderInbox).Items
设置myItems = myInbox.Restrict(qry)
每个myItem in myItems
如果TypeOf myItem是Outlook.MailItem然后
设置myMailitem = myItem
For each att在myMailitem.Attachments
如果att.Type = olEmbeddeditem那么
path =" D:\ test \" &安培; att.FileName
att.SaveAsFile(path)
设置eml = Application.GetNamespace(" MAPI")。OpenSharedItem(path)
设置myCopiedItem = eml.Copy
myCopiedItem。移动Application.GetNamespace(" MAPI")。GetDefaultFolder(olFolderInbox).Folders(" subfolder")
Kill path
End if
Next
End if
下一个
结束子

问候,


Celeste



I have seen a lot of information on how to save Outlook attachments to folders on desktop or network.  I need to extract the attachments from email in an inbox  and move them to another subfolder.  These attachments are emails, doing this by hand every day gets very tiring and I would like a script or macro I can run that will pull all the attachments in the subfolder.  this folder usually has about 500 emails that have at least one email attached to each one.  I need to scrape all of the attached emails into one folder together.

Any Ideas?

Thanks,

LJB

解决方案

Hello,

How do you move these attached mailitem to one folder manually?

Do you open the attached mailitem and then go to File -> Info -> Move to Folder -> Copy to Folder ?

You could firstly search all items with attachments and then check if its attachment is a mail item, then save it into local and open it in Outlook, then you could copy the attached mailitem in a certain folder.

The code below could search inbox and save all attached msg file into subfolder of inbox.

Sub Demo()
Dim qry As String
Dim myInbox As Items
Dim myItems As Items
Dim myItem As Object
Dim myMailitem As MailItem
Dim att As Attachment
Dim path As String
Dim eml As MailItem
Dim myCopiedItem As MailItem
qry = "@SQL=" & Chr(34) & "urn:schemas:httpmail:hasattachment" & Chr(34) & "=1"
Set myInbox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
Set myItems = myInbox.Restrict(qry)
For Each myItem In myItems
If TypeOf myItem Is Outlook.MailItem Then
    Set myMailitem = myItem
    For Each att In myMailitem.Attachments
        If att.Type = olEmbeddeditem Then
            path = "D:\test\" & att.FileName
            att.SaveAsFile (path)
            Set eml = Application.GetNamespace("MAPI").OpenSharedItem(path)
            Set myCopiedItem = eml.Copy
            myCopiedItem.Move Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("subfolder")
            Kill path
        End If
    Next
End If
Next
End Sub

Regards,

Celeste


这篇关于将Outlook附件(即电子邮件本身)保存到Outlook中的另一个文件夹,可以这样做吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆