the example code updated the calendar in exchange server 2007(or Later)  by web services method.

 

 

  1Update Calendar Item In excaheng server  by exchange web services private static WebApplication2.EWS.ExchangeServiceBinding ExchangeSevicesBinding()
  2 update start

 73Update Calendar Item In excaheng server  by exchange web services            CalendarItemType calendarItemType = new CalendarItemType();
 74Update Calendar Item In excaheng server  by exchange web services            calendarItemType.StartSpecified = true;
 75Update Calendar Item In excaheng server  by exchange web services            calendarItemType.Start = calendarItemTypeItem.Start.AddHours(1);
 76Update Calendar Item In excaheng server  by exchange web services           // calendarItemType.End = calendarItemTypeItem.End.AddHours(1);
 77Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees = new AttendeeType[3];
 78Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[0] = new AttendeeType();
 79Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[0].Mailbox = new EmailAddressType();
 80Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[0].Mailbox.EmailAddress = "wu_zaijun@163.com";
 81Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[1] = new AttendeeType();
 82Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[1].Mailbox = new EmailAddressType();
 83Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[1].Mailbox.EmailAddress = "wuzj@heng-zhun.com";
 84Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[2] = new AttendeeType();
 85Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[2].Mailbox = new EmailAddressType();
 86Update Calendar Item In excaheng server  by exchange web services            //calendarItemType.RequiredAttendees[2].Mailbox.EmailAddress = "ahwzj2008@163.com";
 87Update Calendar Item In excaheng server  by exchange web services            SetItemFieldType setItem = new SetItemFieldType();
 88Update Calendar Item In excaheng server  by exchange web services            PathToUnindexedFieldType bodyPath = new PathToUnindexedFieldType();
 89Update Calendar Item In excaheng server  by exchange web services            bodyPath.FieldURI = UnindexedFieldURIType.calendarStart;
 90Update Calendar Item In excaheng server  by exchange web services            setItem.Item = bodyPath;
 91Update Calendar Item In excaheng server  by exchange web services            setItem.Item1 = calendarItemType;
 92Update Calendar Item In excaheng server  by exchange web services            #endregion

 93Update Calendar Item In excaheng server  by exchange web services
 94Update Calendar Item In excaheng server  by exchange web services            // The change description lives within an ItemChange
 95Update Calendar Item In excaheng server  by exchange web services            //
 96Update Calendar Item In excaheng server  by exchange web services            ItemChangeType itemChange = new ItemChangeType();
 97Update Calendar Item In excaheng server  by exchange web services
 98Update Calendar Item In excaheng server  by exchange web services            itemChange.Item = calendarItemTypeItem.ItemId;
 99Update Calendar Item In excaheng server  by exchange web services
100        }

you must special attention to the red  bold text .

if you update other item in exchange server,you can consult the follow xml style.

 

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 3                xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 4   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
 5   xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
 6   <soap:Body>
 7     <UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AutoResolve" 
 8                 xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
 9       <ItemChanges>
10         <t:ItemChange>
11           <t:ItemId Id="AAAtAEFkbWUpdate Calendar Item In excaheng server  by exchange web services" ChangeKey="CQAAABYAUpdate Calendar Item In excaheng server  by exchange web services"/>
12           <t:Updates>
13             <t:AppendToItemField>
14               <t:FieldURI FieldURI="item:Body"/>
15               <t:Message>
16                 <t:Body BodyType="Text">Some additional text to append</t:Body>
17               </t:Message>
18             </t:AppendToItemField>
19           </t:Updates>
20         </t:ItemChange>
21       </ItemChanges>
22     </UpdateItem>
23   </soap:Body>
24 </soap:Envelope>
25 

 

相关文章: