Graph API calendar events skip and top not working properly

MSC - Max Walther 0 Reputation points
2024-11-15T10:10:52.7866667+00:00

I try to access calendar events with the following link:
https://graph.microsoft.com/v1.0/users/user@company.com/calendar/events?top=6 which works. I also got an nextlink at the end: "@odata.nextLink": "https://graph.microsoft.com/v1.0/users/user@company.com/calendar/events?%24top=6&%24skip=6"
If I try to access thsi link I got an 404 Not found: { "error": {

"code": "ErrorItemNotFound",

"message": "The specified object was not found in the store."

}

}

If I test with top=1..3 and skip=1..3 it works. Also if I only sent the request without top and skip i get 404 not found.
If i try to request the events from another user it works.

I think it can't be a permission issue because i get events from the user. So what can cause the problem?
P.S. I checked that the user has more then 6 events in their calendar.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,393 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Yakun Huang-MSFT 6,890 Reputation points Microsoft Vendor
    2024-11-18T02:20:01.7533333+00:00

    Hello MSC - Max Walther,

    Thank you for reaching out to Microsoft Support!

    For your problem, please do the following check:

    1. In Azure AD, check that the accessed user has a valid MS 365 License.

    User's image

    1. If you are using Application permissions, make sure that the Application permissions are granted Calendars.Read and approved by the administrator.

    If you are using delegated permissions, check in the user's mailbox to see if the user has shared the mailbox, and make sure to grant the application Calendars.Read.Shared permissions.

    Screenshot 2024-11-18 021840

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments

  2. MSC - Max Walther 0 Reputation points
    2024-11-18T14:02:19.15+00:00

    Application permission Calendars.Read delegated permission Calendars.Read.Shared are granted. I think otherwise it won't work with other users. All users have an valid Office 365 E3 license.


  3. MSC - Max Walther 0 Reputation points
    2024-11-19T08:06:09.17+00:00

    Thanks for your help. I have decoded the token.
    This is the scope part.

    "scp": "Calendars.Read Calendars.Read.Shared Calendars.ReadWrite Calendars.ReadWrite.Shared MailboxSettings.Read openid profile User.Read User.ReadBasic.All email",
    

    Only one user is sharing his calender with me. I see the shared calender if i use the following get request:
    https://graph.microsoft.com/v1.0/user@company/calendars/
    The other users doesn't share their calendars.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.