class GroupSettingTemplate
GroupSettingTemplate represents system-defined settings templates available to a tenant in Microsoft Graph API, allowing creation of group settings with customizable values.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/setting_template.py
4 - 7
simple
Purpose
This class serves as a model for group setting templates in Microsoft 365/Azure AD environments. It inherits from DirectoryObject and represents read-only templates that define available settings for groups. These templates provide preset default values that can be used to create actual group settings instances with modified values. The class is part of the Office365 REST API Python client library for managing directory objects.
Source Code
class GroupSettingTemplate(DirectoryObject):
"""Group setting templates represent system-defined settings available to the tenant. Group settings can be
created based on the available groupSettingTemplates, and values changed from their preset defaults.
"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
DirectoryObject | - |
Parameter Details
bases: Inherits from DirectoryObject, which provides base functionality for Microsoft Graph directory objects including entity properties, methods for API interactions, and common directory object behaviors
Return Value
Instantiation returns a GroupSettingTemplate object that represents a system-defined settings template. The object provides access to template properties such as display name, description, and available setting definitions that can be queried and used to create group settings.
Class Interface
Methods
__init__(context, resource_path=None)
Purpose: Initializes a GroupSettingTemplate instance, inherited from DirectoryObject
Parameters:
context: ClientContext object for API communication with Microsoft Graphresource_path: Optional resource path for the specific template instance in the API
Returns: GroupSettingTemplate instance
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
display_name |
str | The display name of the group setting template (inherited from DirectoryObject properties) | instance |
description |
str | Description of the template and its purpose (inherited from DirectoryObject properties) | instance |
values |
Collection | Collection of setting value definitions that define available settings and their defaults | instance |
id |
str | Unique identifier for the template (inherited from DirectoryObject) | instance |
Dependencies
office365
Required Imports
from office365.directory.object import DirectoryObject
from office365.directory.group_setting_template import GroupSettingTemplate
Usage Example
from office365.runtime.auth.client_credential import ClientCredential
from office365.graph_client import GraphClient
from office365.directory.group_setting_template import GroupSettingTemplate
# Authenticate
credentials = ClientCredential('client_id', 'client_secret')
client = GraphClient(credentials, 'tenant_id')
# Get all group setting templates
templates = client.directory.setting_templates.get().execute_query()
# Access a specific template
for template in templates:
if isinstance(template, GroupSettingTemplate):
print(f"Template: {template.display_name}")
print(f"Description: {template.description}")
# Use template to create group settings
break
# Get a specific template by ID
template_id = '62375ab9-6b52-47ed-826b-58e47e0e304b'
template = client.directory.setting_templates[template_id].get().execute_query()
Best Practices
- GroupSettingTemplate objects are read-only system-defined templates and should not be modified directly
- Use templates to discover available settings before creating actual group settings instances
- Always authenticate with appropriate permissions (Directory.Read.All minimum) before accessing templates
- Cache template data when possible as templates are system-defined and rarely change
- Use the template's values collection to understand available setting definitions and their default values
- When creating group settings from templates, ensure you copy the template values and modify only what's needed
- Handle API query execution properly using execute_query() method inherited from DirectoryObject
- Check template display names to identify the correct template for your use case (e.g., 'Group.Unified' for Microsoft 365 groups)
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class GroupSetting 73.5% similar
-
class DirectoryRoleTemplate 68.5% similar
-
class Group 62.3% similar
-
class GroupProfile 58.7% similar
-
class TeamGuestSettings 58.6% similar