Scope required to get specific properties with Get-MgUserCalendarView

tk_kop 60 Reputation points
2024-09-30T09:06:17.55+00:00

What scope do I need to get the properties?

Command
Get-MgUserCalendarView

Properties
・Start
・End
・Organizer
・Subject
・IsAllDay
・IsReminderOn
・Attendees
・Location
・Body
・Sensitivity
・Categories
・Importance
・ReminderMinutesBeforeStart

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,311 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,273 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hitesh Pachipulusu - MSFT 3,000 Reputation points Microsoft Vendor
    2024-09-30T10:07:47.1+00:00

    Hello tk_kop,

    Thank you for reaching out to Microsoft Support!

    To retrieve the properties you listed using the Get-MgUserCalendarView command, you need the Calendars.Read or Calendars.Read.Shared scope, depending on whether you are accessing your own calendar or a shared calendar. These scopes allow you to read calendar events and their details.

    Here’s an example of how you might structure the command to include the properties you mentioned:

    Connect-MgGraph -Scopes "Calendars.Read","Calendars.Read.Shared"
    $view=Get-MgUserCalendarView -UserId "user@example.com" -StartDateTime "2024-09-01T00:00:00Z" -EndDateTime "2024-09-30T23:59:59Z" 
    $view.start
    $view.end
    $view.organizer
    $view.subject
    $view.isAllDay
    

    Make sure to replace "user@example.com" with the actual user ID and adjust the date range as needed.

    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

1 additional answer

Sort by: Most helpful
  1. CarlZhao-MSFT 42,526 Reputation points
    2024-09-30T10:41:56.4566667+00:00

    Hi @tk_kop

    It requires the Calendars.Read delegate permission.

    7ded8f63-eef2-458d-b400-9f4d9abe170b

    Hope this helps.

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

    1 person found this answer helpful.
    0 comments No comments

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.