6

I build an app based on this site http://msdn.microsoft.com/en-us/library/dd633661%28v=EXCHG.80%29.aspx

appointment.Subject = "Status Meeting";
appointment.Body = "The purpose of this meeting is to discuss status.";
appointment.Start = new DateTime(2009, 3, 1, 9, 0, 0);
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conf Room";
appointment.RequiredAttendees.Add("user1@contoso.com");
appointment.RequiredAttendees.Add("user2@contoso.com");
appointment.OptionalAttendees.Add("user3@contoso.com");
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

how I can return the XML results "... < t:ItemId Id="AAMkADk=" ChangeKey="DwAAAB" /> ..." so I can use it later to delete or edit the calendar item!?!

Microsoft made a god job with the whole Framework, but did they really forgot this little thing?

I found some (not logical for me) solution Link should I use this to solve the issue?

cheers

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Data-Base
  • 8,418
  • 36
  • 74
  • 98

3 Answers3

8

I could be missing the point, but after the save you can get appointment.Id which I believe is the unique id for this appointment. Store it somewhere and then later you can access the appointment again for edit or delete with:

Appointment appointment = Appointment.Bind(service, new ItemID("saved id value"));

After that you can change the values with the same properties that you used to set them originally and then issue:

appointment.Update(ConflictResolutionMode.AlwaysOverwrite);

or to delete:

appointment.Delete(DeleteMode.HardDelete);

You don't have to access the XML at all.

(n.b. As far I can tell you can't update or delete appointments from Public Folder calendars, although you can create them.)

Tony
  • 818
  • 1
  • 7
  • 21
5

It looks like the solution you found is not returning the XMl results, persay. What the solution is doing is appending a unique identifier to the e-mail as an ExtendedPropertyDefinition. Then after sending it, the solution searches through the "Sent Items" folder to find a saved copy of the e-mail that was just sent by matching on the unique identifier that was appended before the e-mail was sent.

Then as written on the blog,

The following is the XML request that is generated by calling FindItems in the above code example.

<m:FindItem Traversal="Shallow"> 
   <m:ItemShape> 
      <t:BaseShape>IdOnly</t:BaseShape> 
      <t:AdditionalProperties> 
         <t:FieldURI FieldURI="item:Subject" /> 
         <t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" /> 
      </t:AdditionalProperties> 
   </m:ItemShape> 
   <m:IndexedPageItemView MaxEntriesReturned="5" Offset="0" BasePoint="Beginning" /> 
   <m:Restriction> 
      <t:IsEqualTo> 
         <t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" /> 
         <t:FieldURIOrConstant> 
            <t:Constant Value="MyExtendedPropertyValue" /> 
         </t:FieldURIOrConstant> 
      </t:IsEqualTo> 
   </m:Restriction> 
   <m:ParentFolderIds> 
      <t:DistinguishedFolderId Id="sentitems" /> 
   </m:ParentFolderIds> 
</m:FindItem>

Note the XML tag containing the unique identifier.

<t:ExtendedFieldURI PropertySetId="20b5c09f-7cad-44c6-bdbf-8fcbeea08544" PropertyName="MyExtendedPropertyName" PropertyType="String" /> 
bitxwise
  • 3,534
  • 2
  • 17
  • 22
  • thanks, so it is as I understand it some how, so what do I need to do to get the itemID and the ChangeKey ? after I "save" appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy); ? – Data-Base Nov 28 '10 at 15:59
  • Take a look at this link - http://blogs.msdn.com/b/exchangedev/archive/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services.aspx. Keep in mind that EWS is a "web service" and that the results of soliciting the service is serialized (i.e. in XML as you requested). – bitxwise Nov 28 '10 at 19:43
0

Other way is to load the object after your action. But as it is said before, you can use the Appointment.Id.

eL-Prova
  • 1,084
  • 11
  • 27