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: