1
public static ReadMail()
{
ExchangeService Service = new ExchangeService();
Service.Credentials = new WebCredentials("", "", "");
Service.AutodiscoverUrl("[email protected]");
Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox);
StreamingSubscription streamingsubscription = Service.SubscribeToStreamingNotifications(new FolderId[] { WellKnownFolderName.Inbox }, EventType.NewMail);
var connection = new StreamingSubscriptionConnection(Service, 30);
connection.AddSubscription(streamingsubscription);
connection.OnNotificationEvent += OnNotificationEvent;
connection.Open();
}
private static void OnNotificationEvent(object sender, NotificationEventArgs args)
{
Item mail = args.Subscription.Service.FindItems(WellKnownFolderName.Inbox, new ItemView(10)).Items[0];
}
Я подключен к учетной записи электронной почты с использованием сервера обмена (2007). Я могу прочитать почту. после того, как я прочитал & разобрать элемент почты, мне нужно удалить почтовый элемент из папки «Входящие». Пожалуйста, помогите мне. Заранее спасибоУдалить почтовый ящик с помощью сервера Exchange с помощью C#
спасибо Аликс Dong. Извините за задержку с ответом. Я исправил проблему. Ваш код также помог. – suman