Handling several properties of Office365 messages with Microsoft.Exchange.WebServices

Source: Internet
Author: User

It is easy to operate Office365 mail with Microsoft.Exchange.WebServices. Several important attributes are listed here.

Typically, a WebServices object is defined first in the code.

Exchangeservice service = new Exchangeservice ();

(1) service. Timeout = 200000;

The default service operation, Office365, is 100 seconds, but if the program connects to the server for a long time, the connection server time-out occurs frequently, and the timeout attribute allows you to extend the request.

(2) Searchfilter unreadfilter = new Searchfilter.searchfiltercollection (Logicaloperator.and, new Searchfilter.isequalto (Emailmessageschema.isread,false));

With the Serchfilter property, you can customize the type of Get Office365 message, and get unread messages by setting Emailmessageschema.isread to false on the above.

(3) Fetchemail. Load ();

When the message is obtained, the default system does not return the message body subject content (for example, you get 1000 messages at a time, the system only returns core content, such as the message received, the message header, but does not return the message body)

The load () method needs to be called manually

(4) Microsoft.Exchange.WebServices.Data.AttachmentCollection attachments = Fetchemail. Attachments;

WebServices provides a Attachmentcollection object that can get the attachment set for the message.

However, and the message type, the list of attachments returned by the system is just the title of the attachment, so you need to call Fileattachment.load () to get the details of the attachment.

(5) Fetchemail.            Isread = true; Fetchemail. Update (Conflictresolutionmode.alwaysoverwrite);

You can update messages with the Update method.

Handling several properties of Office365 messages with Microsoft.Exchange.WebServices

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.