0

次のコードを使用して、Outlook から電子メールを正常に取得して読み取ることができます。Outlook からメールを削除するにはどうすればよいですか? いくつかの方法を試しましたが、うまくいきませんでした。

var svc = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
svc.Credentials = CredentialCache.DefaultNetworkCredentials;
svc.AutodiscoverUrl(emailAddress);
EmailMessage email = EmailMessage.Bind(svc, emailMessage.Id, props);
4

1 に答える 1

0

I'm not sure (ie, may be proven incorrect) that you can delete messages using this API. The MSDN article for Microsoft.Exchange.Data.Transport.Email Namespace says this:

The Microsoft.Exchange.Data.Transport.Email namespace contains types that support creating, reading, writing, and modifying e-mail message.

And further inspection of the members available on the EmailMessage class suggest you can access various properties, but there's no "delete" operation/method available.

Depending on your scenario, you might have better luck using a tool like Outlook Redemption which will allow low-level programmatic access to Outlook and/or Exchange (but may not be appropriate if you need to go via exchange web services).

于 2012-09-18T02:02:17.053 に答える