EWS (Exchange Web Services) Time Zone Problem Solution

Source: Internet
Author: User

A recent project used the ews api to initiate a meeting. The correct solution cannot be found together with the time zone. If the time zone is incorrect, the meeting time conflicts with the UTC time. The following error is displayed:

The time zone can be set after the msdn query.

 
Timezoneinfo. findsystemtimezonebyid ("China Standard Time"Timezoneinfo. findsystemtimezonebyid ("Central Standard Time"); Indicates the central United States time and so on.

CodeAs follows:

Exchangeservice service = New Exchangeservice (exchangeversion. exchange2010_sp1, timezoneinfo. findsystemtimezonebyid ( "China Standard Time" ); Service. Credentials = New Networkcredential ( "XXXX" , "XXXX" , "Xxx.com" ); Service. url = New Uri ( Https://XXX.XXX.com/EWS/Exchange.asmx" ); // Instantiate an appointment Appointment appointment = New Appointment (service ); // Appointment subject Appointment. Subject = "Test UTC. Is the Beijing time set? " ; // Appointment content Appointment. Body ="Test, Set Beijing Time" ; // Appointment start time 12:30:00 Appointment. Start = New Datetime (2012, 11, 29, 08, 30, 0 ); // End the appointment Appointment. End = appointment. Start. adddays (5 ); // Appointment location Appointment. Location = "216 meeting room" ; // Add attendees Appointment. requiredattendees. Add ( XXX@XXXX.com" ); // Once a week from 12:30:00             // Appointment. Recurrence = new recurrence. weeklypattern (appointment. Start, 1, dayofweek. Saturday );              // You can set the notification sending method, for example:              // Appointment. Save (sendinvitationsmode. sendonlytoall) Appointment. Save (); MessageBox. Show ( "OK" );

Correct:

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.