AppointmentStore.MoveAppointmentAsync always throws an UnauthorizedAccessException RRS feed

  • Question

  • Hi,

    I wanted to extend my app to allow moving an existing appointment from one calendar to another.
    I have read and write access to both calendars - they are only different calendars "categories" on my windows live account.

    The "default" windows live calendar and a "business appointments" calendar, also on windows live.

    A call to 'AppointmentStore.MoveAppointmentAsync' always throws an UnauthorizedAccessException but I DO HAVE access to both calendars (I can create, edit, delete appointments in them).


    System.UnauthorizedAccessException occurred
      _message=Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
      Message=Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
           at Windows.ApplicationModel.Appointments.AppointmentStore.MoveAppointmentAsync(Appointment appointment, AppointmentCalendar destinationCalendar)
           at Week_View_Common.Appointment.AppointmentStoreFascade.<MoveToOtherCalendarAsync>d__1b.MoveNext()
      InnerException: null

    Has anyone used this method successfully?

    best regards,

    Thursday, September 25, 2014 9:32 AM

All replies

  • Hi Hannes - can you post a small sample app for testing?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, September 25, 2014 7:48 PM
  • hi,

    yes, i will do so - unfortunately it's a bit more complicated then it should be since this forum does not allow to attach .zip files, so i could compress and update my project.

    1. Get access to store:

    var store = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);

    2. Query for calendars:

    var calendars = await store.FindAppointmentCalendarsAsync(FindAppointmentCalendarsOptions.None);
    var calendar = calendars.First();

    3. Get appointments:

    var appointments = await store.FindAppointmentsAsync(startDateInclusive, timeSpan, findAppointmentsOptions);
    var appointment = appointments.First();

    4. Instead of using the first entry, there could be an UI to select an appointment and a calendar.

    5. Call the Move method

    await store.MoveAppointmentAsync(appointment, calendar);

    => this call always throws the exception.

    best regards,

    Friday, September 26, 2014 12:39 PM