forked from vgrem/office365-rest-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_team.py
More file actions
19 lines (15 loc) · 719 Bytes
/
create_team.py
File metadata and controls
19 lines (15 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Create a new team.
`TeamCollection.create` is an async operation. To ensure teams gets created `Team.ensure_created` method is called
https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&tabs=http
"""
from office365.graph_client import GraphClient
from tests import create_unique_name
from tests.graph_case import acquire_token_by_username_password
client = GraphClient(acquire_token_by_username_password)
team_name = create_unique_name("Team")
print("Creating a team '{0}' ...".format(team_name))
new_team = client.teams.create(team_name).ensure_created().execute_query()
print("Team has been created")
print("Cleaning up temporary resources... ")
new_team.delete_object().execute_query()