使用Exchange管理的API(EWS)监视邮箱附件

|| 我计划创建一个Windows服务,该服务将监视交换邮箱中具有特定主题的邮件。此类电子邮件的附件需要存储在网络共享的特定文件夹中。我相信我可以使用Exchange Web服务托管API(使用Exchange 2007 SP1)实现此目的。 如果您对此有经验,请分享下面的MSDN链接以外的一些示例或链接,这些可以使我快速入门。 http://msdn.microsoft.com/zh-cn/library/dd633696%28v=EXCHG.80%29.aspx     
已邀请:
可以说这些邮件正在X邮箱中进入您的收件箱。您像这样创建对该文件夹的订阅
PullSubscription subscription = 
SomeExchangeService.SubscribeToPullNotifications(
new FolderId[]{ WellKnownFolderName.Inbox },1440,\"\",EventType.Created);
Subscriptions.Add(subscription);
现在您必须设置一个计时器并检查拉动通知
static void Exchanger_Elapsed(object sender, ElapsedEventArgs e)
    {    
        foreach (var pullSubscription in Subscriptions)
        {
            foreach (var itemEvent in pullSubscription.GetEvents().ItemEvents)
            {
                Item item = Item.Bind(SomeExchangeService, itemEvent.ItemId);
                if (item.Subject == someString)
                {
                  //  item.Attachments do something
                  //  As in read it as a stream and write it 
                  //  to a file according to mime type and file extension
                }
            }
        }
   }
我希望这有帮助... 更新由于电子邮件请求
public static List<PullSubscriptionpublic static List<PullSubscription> Subscriptions = new List<PullSubscription>();> Subscriptions = new List<PullSubscription>();
    
考虑创建一个搜索文件夹以筛选消息。您只需要在搜索文件夹中查找和处理消息。     

要回复问题请先登录注册