在365组上设置组设置

时间:2020-03-30 10:22:28

标签: microsoft-graph-api microsoft-graph-sdks

Microsoft在其网站(https://docs.microsoft.com/en-us/graph/api/groupsetting-update?view=graph-rest-1.0&tabs=csharp)上具有以下示例:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var groupSetting = new GroupSetting
{
    DisplayName = "GroupSettings",
    TemplateId = "08d542b9-071f-4e16-94b0-74abb372e3d9",
    Values = new List<SettingValue>()
    {
        new SettingValue
        {
            Name = "AllowToAddGuests",
            Value = false
        }
    }
};

await graphClient.Groups["{id}"].Settings["{id}"]
    .Request()
    .UpdateAsync(groupSetting);

我们正尝试在特定的365组上禁用外部访问。我尝试了各种组合。但是,Settings [“ {id}”]中的ID应该是什么?

1 个答案:

答案 0 :(得分:0)

根据此link,它说明请求中的第一个{id}是组的标识符(组id),第二个{id}是groupSetting对象的标识符。

要获取groupSetting,您需要使用groupSettingsTemplate创建对象,并且组设置模板ID的显示名称应为“ Group.Unified.Guest”。您无法创建,删除或更新这些模板,但可以使用下面的http调用获取模板ID。 https://graph.microsoft.com/v1.0/groupSettingTemplates

在创建groupSettings对象时,我们需要为您的条件指定以下值。

{

“名称”:“ AllowGuestsToAccessGroups”,

“ value”:“ false”

}

您可以检查有关设置here的信息,如Marc Lafleur所述。

Please check this Image

我下面使用的调用要求输入两个ID,第一个ID是组ID,第二个ID是groupSettings对象ID。

https://graph.microsoft.com/v1.0/groups/df951149-7379-44b9-9add-c114e2137d09/settings/87785da2-114b-428a-8983-e65efd24015f

相关问题