Assign Calendar Privileges with Powershell

Lautaro Baumann 0 Reputation points
2024-09-26T15:25:57.83+00:00

Im trying to assign Calendar Permissions to Owner and Member, Owner should have read&write while members only read.

This is the code i came up with. the error i got was the following:

Specified method is not supported.

Status: 400 (BadRequest)

ErrorCode: ErrorNotSupported

Thank you for your help.

$groupId`` = "your-group-id"

$calendarId`` = "calendar"

$owners`` = Get-MgGroupOwner -GroupId $groupId

$members`` = Get-MgGroupMember -GroupId $groupId

foreach`` ($owner in $owners) {

$ownerId`` = $owner.Id

New-MgUserCalendarPermission`` -UserId $ownerId -CalendarId $calendarId -Role "write"

}

foreach`` ($member in $members) {

$memberId`` = $member.Id

New-MgUserCalendarPermission`` -UserId $memberId -CalendarId $calendarId -Role "read"

}

$groupId
$calendarId
$owners
$members
foreach
$ownerId
New-MgUserCalendarPermission
}
foreach
$memberId
New-MgUserCalendarPermission
}
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,579 questions
0 comments No comments
{count} votes

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.