Teams Service
Team lifecycle management.
teams_lib_pzsp2_z1.services.teams.TeamsService
Bases: BaseService
Service for managing Microsoft Teams lifecycle and properties via the Go backend.
This class acts as a high-level Python wrapper. It delegates logical operations to the underlying Go library.
Concepts:
* References: The teamRef argument accepts either the Team UUID or the
Team Display Name. The Go backend resolves these automatically.
* Context: Operations are executed on behalf of the authenticated user
(derived from the MSAL context).
* Caching: If the Go client was initialized with cache enabled, this service
will transparently use cached team references to reduce API calls.
Source code in teams_lib_pzsp2_z1/services/teams.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
Functions
archive(team_ref, spo_read_only_from_members)
Archives a team.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_ref
|
str
|
The reference to the team (UUID or Display Name). |
required |
spo_read_only_from_members
|
bool
|
If True, sets the associated SharePoint site to read-only for members. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the team was successfully archived. |
Source code in teams_lib_pzsp2_z1/services/teams.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
create_from_template(display_name, description, owners, members=None, visibility='public', include_me=True)
Creates a new team based on a template.
This operation is often asynchronous.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_name
|
str
|
The name of the team. |
required |
description
|
str
|
A brief description of the team. |
required |
owners
|
list[str]
|
A list of user references (IDs or emails) to be owners. |
required |
members
|
list[str] | None
|
A list of user references to be members. Defaults to None. |
None
|
visibility
|
str
|
The privacy level ('public' or 'private'). Defaults to "public". |
'public'
|
include_me
|
bool
|
Whether to add the authenticated user as an owner. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the newly created team (or the async operation ID). |
Source code in teams_lib_pzsp2_z1/services/teams.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
create_via_group(display_name, mail_nickname, visibility)
Creates a new team associated with a standard Microsoft 365 group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_name
|
str
|
The name of the new team. |
required |
mail_nickname
|
str
|
The mail alias for the underlying group. |
required |
visibility
|
str
|
The privacy level ('Public' or 'Private'). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Team |
Team
|
The newly created team object. |
Source code in teams_lib_pzsp2_z1/services/teams.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
delete(team_ref)
Deletes a team (soft delete).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_ref
|
str
|
The reference to the team (UUID or Display Name). |
required |
Returns: bool: True if the delete request was successful.
Source code in teams_lib_pzsp2_z1/services/teams.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
get(team_ref)
Retrieves a specific team by its reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_ref
|
str
|
The reference to the team (UUID or Display Name). |
required |
Returns: Team: The requested team object containing details like ID, DisplayName, and Visibility.
Source code in teams_lib_pzsp2_z1/services/teams.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
list_my_joined()
Lists all teams that the authenticated user has joined.
Returns:
| Type | Description |
|---|---|
list[Team]
|
list[Team]: A list of team objects the user is a member of. |
Source code in teams_lib_pzsp2_z1/services/teams.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
restore_deleted(deleted_team_ID)
Restores a previously deleted team.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deleted_team_ID
|
str
|
The ID of the deleted group/team. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the restored team/group. |
Source code in teams_lib_pzsp2_z1/services/teams.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
unarchive(team_ref)
Restores an archived team to an active state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_ref
|
str
|
The reference to the team (UUID or Display Name). |
required |
Returns: bool: True if the team was successfully unarchived.
Source code in teams_lib_pzsp2_z1/services/teams.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
update(team_ref, update)
Applies updates to a team's properties.
Only fields that are not None in the update object will be modified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
team_ref
|
str
|
The reference to the team (UUID or Display Name). |
required |
update
|
UpdateTeam
|
An object containing the fields to update (e.g., DisplayName). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Team |
Team
|
The updated team object. |
Source code in teams_lib_pzsp2_z1/services/teams.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |