阅读Outlook

时间:2016-05-18 10:33:41

标签: vbscript outlook server copy

我想阅读outlook中收到的邮件的发件人以及发件人是否与某个发件人匹配。是否应该从一个远程服务器到另一个远程服务器进行复制过程?有谁可以帮助我?

2 个答案:

答案 0 :(得分:1)

VB脚本代码:

Set objOutlook= CreateObject("Outlook.Application")
Set OutlookSetNameSpace = objOutlook.GetNamespace("MAPI")
Set OutlookSetFolder = OutlookSetNameSpace.GetDefaultFolder(6) ' 6 for Inbox folder
Set objAllMails= OutlookSetFolder.Items
MailProperty="From"
MailPropertyValue= "xyz@abc.com"
Set ObjFilteredMails=objAllMails.Restrict("[" & MailProperty & "] = " & MailPropertyValue)
UreadCount=ObjFilteredMails.Count
if UreadCount>0 then
 '---write your copy script here
End if

答案 1 :(得分:1)

Kiran回答的更正版本:

Set objOutlook= CreateObject("Outlook.Application")
Set OutlookSetNameSpace = objOutlook.GetNamespace("MAPI")
Set OutlookSetFolder = OutlookSetNameSpace.GetDefaultFolder(6) ' 6 for Inbox folder
Set objAllMails= OutlookSetFolder.Items
MailProperty="From"
MailPropertyValue= "xyz@abc.com"
Set ObjFilteredMails=objAllMails.Restrict("[" & MailProperty & "] = '" & MailPropertyValue & "'")  ' needs quoted
UreadCount=ObjFilteredMails.Count
if UreadCount>0 then
 '---write your copy script here
End if