none
[Exchange-Online][EWS][C#][Windows] FindAppointments returns privates, while Appointment.Bind - not RRS feed

  • Question

  • Exchange Version: Exchange-Online/2013
    IDE: MS Visual Studio 2013
    Targeted features: Items synchronization

    I am synchronizing room mailbox with .NET Exchange service calling SyncFolderItems (Id properties only). After I get the list of changed ID's, I try to load them. Everything works except that I can't load private appointment to get it's Start-End time. I get error: {The specified object was not found in the store., Item not found.}.

    ChangeCollection<ItemChange> icc = _exchangeService.SyncFolderItems(new FolderId(WellKnownFolderName.Calendar, new Mailbox(email)),
    PropertySet.IdOnly, null, 50, SyncFolderItemsScope.NormalItems, "");
    foreach (ItemChange itemChange in icc)
    {
      ExchangeAppointment appointment = Appointment.Bind(_exchangeService, itemChange.ItemId, PropertySet.FirstClassProperties);
    }

    You would think permissions right? But I can do the same thing with:

    var f = new FolderId(WellKnownFolderName.Calendar, new Mailbox(email));
    CalendarView cv = new CalendarView(new DateTime(2016, 4, 20, 0, 0, 0), new DateTime(2016,4,20,23,59,59));
    FindItemsResults<ExchangeAppointment> items = _exchangeService.FindAppointments(f, cv);
    And I get the needed private appointments.



    • Edited by Modestas.S Thursday, April 21, 2016 4:19 PM
    Thursday, April 21, 2016 4:18 PM

All replies

  • What happens if you loop through the items in the second example and try to bind eg

    var f = new FolderId(WellKnownFolderName.Calendar, new Mailbox(email)); CalendarView cv = new CalendarView(new DateTime(2016, 4, 20, 0, 0, 0), new DateTime(2016,4,20,23,59,59)); FindItemsResults<ExchangeAppointment> items = _exchangeService.FindAppointments(f, cv);
    foreach (Item itItem in items.Items)
    {
     
    ExchangeAppointment appointment = Appointment.Bind(_exchangeService, itItem.Id, PropertySet.FirstClassProperties);
    }

    Do you get the same issue ?

    If not I would say the ItemId's getting return by SyncfolderItems are for Items that no longer exist or where the EWSId has changed, for calendar appointments under certain cases when updates occur the Item is deleted and recreated and while the Appointment is still the same the Id given is nolonger valid. There is where using a non changing CalendarId is preferred like PidTagCleanGlobalObjectId https://msdn.microsoft.com/en-us/library/office/cc815676.aspx

    Cheers
    Glen

    Friday, April 22, 2016 4:17 AM
  • >>Do you get the same issue ?

    I tried what you asked and yes I got the same error.

    About the ID's. Actually they are the same. I selected Item ID from FindAppointments and compared with the one I get from SyncFolderItems - they are same. 


    Friday, April 22, 2016 8:28 AM
  • What rights does the user have on the folder in question ? are they are also a delegate of the Mailbox ? if so do the delegate permission allow access to private Items ? (If its a meeting room they probably are a delegate I would suggest maybe create a new account for test and grant the full rights to the Mailbox without making it a delegate). using Impersonation would be another way of working around the issue.

    Cheers
    Glen

    Friday, April 22, 2016 11:45 PM