🔍 Code Extractor

class GroupSettingTemplate

Maturity: 42

GroupSettingTemplate represents system-defined settings templates available to a tenant in Microsoft Graph API, allowing creation of group settings with customizable values.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/setting_template.py
Lines:
4 - 7
Complexity:
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 Graph
  • resource_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)

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class GroupSetting 73.5% similar

    GroupSetting is an Entity subclass that represents configuration settings for Microsoft 365 groups, controlling behaviors like blocked word lists for display names and guest user permissions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/setting.py
  • class DirectoryRoleTemplate 68.5% similar

    A class representing a directory role template in Microsoft Graph API, which specifies property values for directory roles.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/rolemanagement/template.py
  • class Group 62.3% similar

    Represents an Azure Active Directory (Azure AD) group, which can be an Office 365 group or a security group, providing methods to manage group operations, memberships, and associated resources.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/group.py
  • class GroupProfile 58.7% similar

    GroupProfile is a data class that represents the profile configuration for a Microsoft 365/Azure AD group, encapsulating properties like name, description, mail settings, and security settings.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/profile.py
  • class TeamGuestSettings 58.6% similar

    A configuration class that defines permission settings for guest users in a Microsoft Teams team, specifically controlling whether guests can create, update, or delete channels.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/teams/guest_settings.py
← Back to Browse