forked from vgrem/Office365-REST-Python-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.py
21 lines (17 loc) · 787 Bytes
/
move.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
Move a message to another folder within the specified user's mailbox.
This creates a new copy of the message in the destination folder and removes the original message.
https://learn.microsoft.com/en-us/graph/api/message-move?view=graph-rest-1.0&tabs=http
"""
from office365.graph_client import GraphClient
from tests.graph_case import acquire_token_by_username_password
client = GraphClient(acquire_token_by_username_password)
folder_name = "Archive"
to_folder = client.me.mail_folders[folder_name]
message = client.me.messages.add(
subject="Meet for lunch?",
body="The new cafeteria is open.",
to_recipients=["[email protected]"],
)
message.move(to_folder).execute_query()
print("Draft message is created && moved into {0} folder".format(folder_name))