10

So I'm creating Exchange (2007) Appointments with a given ICalUid:

var app = new Appointment(svc);
app.ICalUid = id;
app.Subject = "Test Appointment";
app.Recurrence = new Recurrence.DailyPattern(DateTime.Now, 3);
app.RequiredAttendees.Add("mstum@example.com");
app.AllowNewTimeProposal = false;
app.Body = new MessageBody(BodyType.HTML, "This is a <b>Test!</b>");
app.Save();

Later on, I would like to update that appointment, at which point I need to find it through the ICalUid.

However, there seems to be no way to do that? I can use Appointment.Bind only against the Exchange ID, which I don't have at the time of update (storing it is highly impractical)

I can create a new appointment with the same ICalUid, which seems to behave like an update, but asks to Accept/Reject again instead of just displaying "No Update Required".

Is there any proper way to do that?

Michael Stum
  • 177,530
  • 117
  • 400
  • 535

3 Answers3

8

You can use a ExchangeService.FindItems to search for the Appointment with the ICalUid - see the example below. Note though, it has a problem finding Appointments that are recurring.

See:

Shame you aren't using Exchange 2010, as there is a getICalUID() in EWS Managed API 1.1.5.

Here are some other links that may allow you to get a more satisfactory solution.

Colin Smith
  • 12,375
  • 4
  • 39
  • 47
  • Thanks, that doesn't seem to find it though, even if I remove the recurrence :( In what format should the ICalUid be? I've been using a Guid before,but that throws an exception in the `GetObjectIdStringFromUid` method. Using a hex string like `012345` doesn't throw an exception, but doesn't find the appointment either. – Michael Stum Jul 17 '12 at 19:48
  • I think you have to encode it as Base64 - it's mentioned in one of the links..http://social.technet.microsoft.com/Forums/en/exchangesvrdevelopment/thread/a9148747-b51c-4b86-b942-27c1e87f4440 – Colin Smith Jul 17 '12 at 19:51
  • That doesn't do it either :( Looking with OutlookSpy, I can't see the iCalUid in any of the fields either, but that doesn't need to mean much. Still, Exchange doesn't seem to find it. – Michael Stum Jul 20 '12 at 06:00
  • Could you expand your example code a bit more ? e.g. show us what your id looks like....are you just generating a unique GUID on the fly each time ? Do you use a GUID string that includes the dashes? or do you strip them out? Maybe you should specify just the HEX codes for the id when you create the Appointment e.g. 000C020304etc. Finally, look at this....http://d-push.sourcearchive.com/documentation/1.5.3-1/utils_8php_source.html ....might give some clues. – Colin Smith Jul 20 '12 at 09:43
  • Here's an alternative example that is doing the FindItems. http://archive.cnblogs.com/a/2173625/ – Colin Smith Jul 20 '12 at 09:53
  • And one final link: http://www.infini-tec.de/post/2009/04/13/Searching-a-meeting-with-a-specific-UID-using-Exchange-Web-Services-2007.aspx – Colin Smith Jul 20 '12 at 10:01
3

check the two FindAppointments methods of ExchangeService

http://msdn.microsoft.com/en-us/library/dd635918(v=exchg.80)

http://msdn.microsoft.com/en-us/library/dd633767(v=exchg.80)

zeFrenchy
  • 6,541
  • 1
  • 27
  • 36
  • That doesn't seem to have any way to specify a filter for the iCal UID (or anything else) – Michael Stum Jul 22 '12 at 07:47
  • Yes the only search method available seem to be by date range. What contextual information regarding the appointment do you have when you need to make an update? Could you do a search by date, then iterate through the results until you find your ID? Not great I know. – zeFrenchy Jul 22 '12 at 08:26
1

Doesn't seem that 2007 has a way at all.

Michael Stum
  • 177,530
  • 117
  • 400
  • 535