class GroupProfile
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.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/groups/profile.py
5 - 29
simple
Purpose
This class serves as a data transfer object (DTO) for creating or representing Microsoft 365/Azure AD group profiles. It inherits from ClientValue, indicating it's part of the Office365 REST API client library. The class is used to define group properties including display name, mail nickname, security settings, group types, and associated members/owners. It's typically used when creating new groups or updating existing group properties through the Microsoft Graph API or Office365 REST API.
Source Code
class GroupProfile(ClientValue):
def __init__(
self,
name,
description=None,
mail_enabled=False,
security_enabled=True,
group_types=None,
):
"""
:param str name: The display name for the group
:param str description: An optional description for the group.
:param bool mail_enabled: Specifies whether the group is mail-enabled. Default: false
:param bool security_enabled: Specifies whether the group is a security group. Default: true.
:param list[str] group_types:
"""
super(GroupProfile, self).__init__()
self.mailNickname = name
self.displayName = name
self.description = description
self.mailEnabled = mail_enabled
self.securityEnabled = security_enabled
self.owners = None
self.members = None
self.groupTypes = StringCollection(group_types)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
name: The display name for the group. This value is used for both the displayName and mailNickname properties. Required parameter that identifies the group to users.
description: An optional text description for the group that provides additional context about the group's purpose. Defaults to None if not provided.
mail_enabled: Boolean flag indicating whether the group is mail-enabled (can receive emails). Set to False by default, meaning the group won't have email capabilities unless explicitly enabled.
security_enabled: Boolean flag specifying whether the group is a security group (used for access control). Set to True by default, making it a security group by default.
group_types: A list of strings defining the group types (e.g., ['Unified'] for Microsoft 365 groups). This parameter determines special characteristics of the group. Defaults to None, which creates a standard group.
Return Value
Instantiation returns a GroupProfile object with all specified properties set. The object contains attributes for mailNickname, displayName, description, mailEnabled, securityEnabled, owners, members, and groupTypes. The owners and members attributes are initialized to None and can be populated later. The groupTypes attribute is wrapped in a StringCollection object.
Class Interface
Methods
__init__(self, name, description=None, mail_enabled=False, security_enabled=True, group_types=None)
Purpose: Initializes a new GroupProfile instance with the specified group configuration properties
Parameters:
name: The display name for the group (used for both displayName and mailNickname)description: Optional description text for the groupmail_enabled: Boolean indicating if the group can receive emails (default: False)security_enabled: Boolean indicating if this is a security group (default: True)group_types: List of strings defining special group types like 'Unified' for Microsoft 365 groups
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
mailNickname |
str | The mail alias for the group, set to the same value as the name parameter | instance |
displayName |
str | The display name shown to users, set to the same value as the name parameter | instance |
description |
str or None | Optional text description providing context about the group's purpose | instance |
mailEnabled |
bool | Flag indicating whether the group is mail-enabled and can receive emails | instance |
securityEnabled |
bool | Flag indicating whether the group is a security group used for access control | instance |
owners |
None (initially) | Placeholder for group owners, initialized to None and populated separately | instance |
members |
None (initially) | Placeholder for group members, initialized to None and populated separately | instance |
groupTypes |
StringCollection | Collection of strings defining special group types (e.g., 'Unified' for Microsoft 365 groups) | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
Usage Example
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
# Create a basic security group profile
group_profile = GroupProfile(
name="Engineering Team",
description="Group for engineering department members",
security_enabled=True,
mail_enabled=False
)
# Create a Microsoft 365 group (mail-enabled, unified group)
m365_group_profile = GroupProfile(
name="Marketing Team",
description="Marketing department collaboration group",
mail_enabled=True,
security_enabled=False,
group_types=["Unified"]
)
# Access the properties
print(group_profile.displayName) # "Engineering Team"
print(group_profile.mailNickname) # "Engineering Team"
print(group_profile.securityEnabled) # True
print(m365_group_profile.groupTypes) # StringCollection with ["Unified"]
Best Practices
- Always provide a meaningful name parameter as it's used for both displayName and mailNickname
- Set mail_enabled=True and group_types=['Unified'] when creating Microsoft 365 groups (formerly Office 365 groups)
- For security groups used only for access control, keep mail_enabled=False and security_enabled=True (the defaults)
- The owners and members attributes are initialized to None and should be populated separately after group creation
- The groupTypes parameter accepts specific values like 'Unified' for Microsoft 365 groups; consult Microsoft Graph API documentation for valid values
- This class is typically used as a parameter when calling group creation methods in the Office365 API client, not used standalone
- The class inherits from ClientValue, which provides serialization capabilities for REST API communication
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Group 71.2% similar
-
class PasswordProfile 65.2% similar
-
class DisableGroupify 63.3% similar
-
class GroupCreationInformation_v1 62.6% similar
-
class GroupCollection 62.2% similar