英文:
Using MgGraph PowerShell 1.0 - Update-MgGroup -AdditionalProperties how to update the resourceBehaviorOptions option?
问题
教育机构我正在帮助的使用“Moodle插件Microsoft 0365集成”,我认为它使用最新的“MgGraph v1.0”来创建“Microsoft 365 Teams群组”。
“Moodle插件”创建了“Microsoft 365 Teams群组”,但在创建后,某些“设置”无法在管理交换中心上更新,它返回一个错误。
收到的错误信息实际上没有帮助
这个Microsoft 365 Teams群组使用了HiddenMembership Visibility,因为MS Teams课程也可以使用,并且出于隐私原因使用了这种可见性。不幸的是,由Moodle MS插件创建的PHP代码添加了更多的安全功能,阻止了群组之间发送电子邮件,因为上面的属性无法更新。
为了获取有关错误的更多信息,我尝试使用MgGraph以编程方式设置“设置”
$params = @{
AutoSubscribeNewMembers = $true
}
Update-MgGroup -GroupId $groupid -BodyParameter $params
然后我得到了以下错误:
<pre>
当SubscriptionEnabled为false时,AutoSubscribeNewMembers参数不能为true。
</pre>
寻找了一圈,我终于找到了“SubscriptionEnabled”值在哪里设置。
((get-MgGroup -GroupId $groupid).AdditionalProperties).resourceBehaviorOptions
> 输出:
<pre>
SubscriptionDisabled
SharePointMemberReadonly
CalendarMemberReadOnly
WelcomeEmailDisabled
SubscribeNewGroupMembers
HideGroupInOutlook
ConnectorsDisabled
AllowOnlyMembersToPost
</pre>
我尝试删除“SubscriptionDisabled”选项从“resourceBehaviorOptions”部分,但得到以下错误。
$resourceBehaviorOptionsParams = @{
"SubscriptionDisabled" = "false"
}
$additionalParams = @{
resourceBehaviorOptions = $resourceBehaviorOptionsParams
}
Update-MgGroup -GroupId $groupid -AdditionalProperties $additionalParams
> 错误
<pre>
在从JSON阅读器中读取属性“resourceBehaviorOptions”时,发现了意外的“StartObject”节点。预期是一个“StartArray”节点。
</pre>
如何从“resourceBehaviorOptions”部分中删除“SubscriptionDisabled”选项?
英文:
The education institution, I am helping, uses the Moodle Plugin Microsoft 0365 Integration
which I believe uses the latest MgGraph v1.0
to create Microsoft 365 Teams Groups
.
The Moodle plugin
creates Microsoft 365 Teams Groups
but some Settings
can not be updated on the Admin Exchange Center after its creation, It returns an Error.
The error received is not really helping
This Microsoft 365 Teams Group uses the HiddenMembership Visibility since MS Teams Classes can also be used and for privacy reasons this visibility is used. Unfortunately, the PHP code created by the Moodle MS Plugin adds more security features that prevents the groups from sending emails to each other since the above property can not be updated.
To get more information about the error, I tried to use MgGraph to set the Setting
programmatically
$params = @{
AutoSubscribeNewMembers = $true
}
Update-MgGroup -GroupId $groupid -BodyParameter $params
Than I go the below error:
<pre>
AutoSubscribeNewMembers parameter can't be true when SubscriptionEnabled
is set to false on the group.
</pre>
Looking all around, I finally found where the SubscriptionEnabled
value is set.
((get-MgGroup -GroupId $groupid).AdditionalProperties).resourceBehaviorOptions
> Outputs :
<pre>
SubscriptionDisabled
SharePointMemberReadonly
CalendarMemberReadOnly
WelcomeEmailDisabled
SubscribeNewGroupMembers
HideGroupInOutlook
ConnectorsDisabled
AllowOnlyMembersToPost
</pre>
I tried to remove that value from the Group's AdditionalProperties.resourceBehaviorOptions but get this error.
$resourceBehaviorOptionsParams = @{
"SubscriptionDisabled" = "false";
}
$additionalParams = @{
resourceBehaviorOptions = $resourceBehaviorOptionsParams
}
Update-MgGroup -GroupId $groupid -AdditionalProperties $additionalParams
> Error
<pre>
An unexpected 'StartObject' node was found for property named 'resourceBehaviorOptions' when
| reading from the JSON reader. A 'StartArray' node was expected.
</pre>
How can I remove the SubscriptionDisabled
Option from the resourceBehaviorOptions
section ?
答案1
得分: 0
我尝试在我的环境中复制相同的操作,但出现了与下面相同的错误
> 如果你没有适当的许可证,比如Exchange Online,或者该团队组的订阅被禁用,通常会出现此错误。
当我运行与你相同的MgGraph命令以获取更多关于错误的信息时,我得到了与下面相同的响应:
Connect-MgGraph
$groupid = "f2210ee6-451a-496b-8b39-c2xxxxxxxf"
$params = @{
AutoSubscribeNewMembers = $true
}
Update-MgGroup -GroupId $groupid -BodyParameter $params
响应:
当我尝试运行与你相同的脚本以删除SubscriptionDisabled选项时,我得到了相同的错误,如下所示:
$groupid = "f2210ee6-451a-496b-8b39-c289xxxxxdaf"
$resourceBehaviorOptionsParams = @{
"SubscriptionDisabled" = "false";
}
$additionalParams = @{
resourceBehaviorOptions = $resourceBehaviorOptionsParams
}
Update-MgGroup -GroupId $groupid -AdditionalProperties $additionalParams
响应:
为了解决此错误,你可以使用以下Exchange Online命令为该团队组启用订阅:
Connect-ExchangeOnline
Set-UnifiedGroup -Identity "Devi Team" -SubscriptionEnabled:$true
响应:
启用订阅后,我运行了以下命令以像这样启用AutoSubscribeNewMembers
:
Set-UnifiedGroup -Identity "Devi Team" -AutoSubscribeNewMembers:$true
响应:
当我在Exchange Admin Center中检查相同的选项时,选项已成功启用,如下所示:
如果需要,你还可以在启用订阅后从门户中像这样启用***“允许外部发件人给该组发送电子邮件”***选项:
英文:
I tried to reproduce the same in my environment and got same error like below
> The error usually occurs if you don't have proper license like
> Exchange Online or the subscription is disabled on that teams group.
When I ran the same MgGraph commands as you to know more about error, I got same response like below:
Connect-MgGraph
$groupid = "f2210ee6-451a-496b-8b39-c2xxxxxxxf"
$params = @{
AutoSubscribeNewMembers = $true
}
Update-MgGroup -GroupId $groupid -BodyParameter $params
Response:
When I tried the same script as you to remove the SubscriptionDisabled Option, I got same error like below:
$groupid = "f2210ee6-451a-496b-8b39-c289xxxxxdaf"
$resourceBehaviorOptionsParams = @{
"SubscriptionDisabled" = "false";
}
$additionalParams = @{
resourceBehaviorOptions = $resourceBehaviorOptionsParams
}
Update-MgGroup -GroupId $groupid -AdditionalProperties $additionalParams
Response:
To resolve the error, you can enable subscription for that teams group using below Exchange Online commands:
Connect-ExchangeOnline
Set-UnifiedGroup -Identity "Devi Team" -SubscriptionEnabled:$true
Response:
After enabling the subscription, I ran below command to enable AutoSubscribeNewMembers
like this:
Set-UnifiedGroup -Identity "Devi Team" -AutoSubscribeNewMembers:$true
Response:
When I checked the same in Exchange Admin Center, option enabled successfully like below:
You can also enable "Allow external senders to email this group" option if needed from Portal like this after enabling subscription:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论