Solved

C# create calendar item with EWS, how to get back the reslust?

Posted on 2010-11-27
4
2,449 Views
Last Modified: 2013-12-17
Hello, 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);

Open in new window


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 http://blogs.msdn.com/b/exchangedev/archive/2010/02/25/determining-the-id-of-a-sent-message-by-using-extended-properties-with-the-ews-managed-api.aspx should I use this to solve the issue?

cheers
0
Comment
Question by:Data-Base
  • 2
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
ID: 34229217
the Appointment object has an Id property.  this is the itemId from XML.

http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.appointment_members(EXCHG.80).aspx
 ....  Id   Gets the ID of this item. (inherited from Item)
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
//now can get the EWS id of the item.
string apptId = appointment.Id.UniqueId;

Open in new window

0
 

Author Comment

by:Data-Base
ID: 34229347
what about the "ChangeKey", do I need it for something else? why it is there?

Thanks by the way, I will test now :-)
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 34245849
ChangeKey does not appear to be part of the API.

I believe it is usually used with synchronization. ie tell if an item has been changed.   using SyncFolderItems on a folder is probably easier but not as granular
0
 

Author Closing Comment

by:Data-Base
ID: 34275396
Thanks allot :-)
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In-place Upgrading Dirsync to Azure AD Connect
This video discusses moving either the default database or any database to a new volume.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question