比方說,這些郵件正在進入X上的郵箱收件箱。創建像這樣
PullSubscription subscription =
SomeExchangeService.SubscribeToPullNotifications(
new FolderId[]{ WellKnownFolderName.Inbox },1440,"",EventType.Created);
Subscriptions.Add(subscription);
訂閱到該文件夾現在你必須設置一個計時器,並檢查拉notifs
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
}
}
}
}
我希望這有助於...
UPDATE由於電子郵件請求
public static List<PullSubscriptionpublic static List<PullSubscription> Subscriptions = new List<PullSubscription>();> Subscriptions = new List<PullSubscription>();
有什麼建議嗎? – 2011-04-21 06:03:58
@Pratick Kothari你有沒有試過在serverfault上問這個問題?我想你會在這個網站上有更多的運氣。 – calumbrodie 2011-04-28 13:49:29
您是否試圖將附件保存到文件夾?還是你想移動電子郵件? – Sevki 2011-04-28 14:00:39