-
-
Notifications
You must be signed in to change notification settings - Fork 370
Expand file tree
/
Copy pathcreate_team.py
More file actions
28 lines (22 loc) · 778 Bytes
/
create_team.py
File metadata and controls
28 lines (22 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Create a new team.
Since `TeamCollection.create` is an async operation, execute_query_and_wait is called to ensure teams gets created
https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0
"""
from office365.graph_client import GraphClient
from tests import (
create_unique_name,
test_client_id,
test_password,
test_tenant,
test_username,
)
client = GraphClient(tenant=test_tenant).with_username_and_password(
test_client_id, test_username, test_password
)
team_name = create_unique_name("Team")
print("Creating a team '{0}' ...".format(team_name))
team = client.teams.create(team_name).execute_query_and_wait()
print("Team has been created")
print("Cleaning up temporary resources... ")
team.delete_object().execute_query()