Skip to content

Commit e98f7e3

Browse files
committed
add changes.
1 parent 2ed5043 commit e98f7e3

File tree

3 files changed

+98
-151
lines changed

3 files changed

+98
-151
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"python.linting.pylintEnabled": false,
44
"python.pythonPath": "C:\\Users\\Alex\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
55
"python.linting.flake8Enabled": true,
6-
"python.linting.flake8Args": [
7-
"--max-line-length=120",
8-
"--ignore=E402",
9-
],
6+
"python.linting.flake8Args": ["--max-line-length=140", "--ignore=E402"]
107
}

samples/use_mail_services.py

Lines changed: 97 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -69,95 +69,107 @@
6969
# Grab the Notes Services.
7070
mail_services = graph_client.mail()
7171

72-
# # Grab all my Messages.
73-
# pprint(mail_services.list_my_messages())
74-
75-
# # Grab a specific message for the default user.
76-
# pprint(mail_services.get_my_messages(message_id=mail_id))
77-
78-
# pprint(
79-
# mail_services.get_user_messages(
80-
# user_id=user_id,
81-
# message_id=mail_id
82-
# )
83-
# )
84-
85-
# # This creates a draft message.
86-
# new_message_draft = mail_services.create_my_message(
87-
# message={
88-
# "subject": "Did you see last night's game?",
89-
# "importance": "Low",
90-
# "body": {
91-
# "contentType": "HTML",
92-
# "content": "They were <b>awesome</b>!"
93-
# },
94-
# "toRecipients": [
95-
# {
96-
# "emailAddress": {
97-
# "address": "[email protected]"
98-
# }
99-
# }
100-
# ]
101-
# }
102-
# )
103-
# pprint(new_message_draft)
104-
105-
# # grab the ID.
106-
# new_message_id = new_message_draft['id']
107-
108-
# # Method One, send the message by grabbing the ID.
109-
# mail_services.send_my_message(message_id=new_message_id)
110-
111-
# # List the rules for a specific user..
112-
# pprint(
113-
# mail_services.list_rules(user_id=user_id)
114-
# )
115-
116-
# # List the rules for the default user.
117-
# pprint(
118-
# mail_services.list_my_rules()
119-
# )
120-
121-
# # List the overrides for a specific user.
122-
# pprint(
123-
# mail_services.list_overrides(user_id=user_id)
124-
# )
125-
126-
# # List the overrides for the default user.
127-
# pprint(
128-
# mail_services.list_my_overrides()
129-
# )
130-
131-
# # Create a new rule for the default user.
132-
# pprint(
133-
# mail_services.create_my_message_rule(
134-
# rule={
135-
# "displayName": "From partner",
136-
# "sequence": 2,
137-
# "isEnabled": True,
138-
# "conditions": {
139-
# "senderContains": [
140-
# "youtube"
141-
# ]
142-
# },
143-
# "actions": {
144-
# "forwardTo": [
145-
# {
146-
# "emailAddress": {
147-
# "name": "Alex Reed",
148-
# "address": "[email protected]"
149-
# }
150-
# }
151-
# ],
152-
# "stopProcessingRules": True
153-
# }
154-
# }
155-
# )
156-
# )
72+
# Grab all my Messages.
73+
pprint(
74+
mail_services.list_my_messages()
75+
)
76+
77+
# Grab a specific message for the default user.
78+
pprint(
79+
mail_services.get_my_messages(
80+
message_id=mail_id
81+
)
82+
)
83+
84+
# Get a Specific User's Message.
85+
pprint(
86+
mail_services.get_user_messages(
87+
user_id=user_id,
88+
message_id=mail_id
89+
)
90+
)
91+
92+
# List the rules for a specific user..
93+
pprint(
94+
mail_services.list_rules(user_id=user_id)
95+
)
96+
97+
# List the rules for the default user.
98+
pprint(
99+
mail_services.list_my_rules()
100+
)
101+
102+
# List the overrides for a specific user.
103+
pprint(
104+
mail_services.list_overrides(user_id=user_id)
105+
)
106+
107+
# List the overrides for the default user.
108+
pprint(
109+
mail_services.list_my_overrides()
110+
)
157111

158112
# List the attachments for a specific message.
159113
pprint(
160114
mail_services.list_my_attachements(
161115
message_id=mail_id_with_attachments
162116
)
163117
)
118+
119+
120+
# Create a new message for the default user. Keep in mind this does not send the mail.
121+
new_message_draft = mail_services.create_my_message(
122+
message={
123+
"subject": "Did you see last night's game?",
124+
"importance": "Low",
125+
"body": {
126+
"contentType": "HTML",
127+
"content": "They were <b>awesome</b>!"
128+
},
129+
"toRecipients": [
130+
{
131+
"emailAddress": {
132+
"address": "[email protected]"
133+
}
134+
}
135+
]
136+
}
137+
)
138+
139+
# Check it out.
140+
pprint(new_message_draft)
141+
142+
# grab the ID.
143+
new_message_id = new_message_draft['id']
144+
145+
# Send the newly created message.
146+
mail_services.send_my_message(message_id=new_message_id)
147+
148+
# Let's create a new message rule, this will help with things like incoming mail. We can
149+
# control what happens to mail that meets certain conditions.
150+
my_new_message_rule = mail_services.create_my_message_rule(
151+
rule={
152+
"displayName": "From partner",
153+
"sequence": 2,
154+
"isEnabled": True,
155+
"conditions": {
156+
"senderContains": [
157+
"youtube"
158+
]
159+
},
160+
"actions": {
161+
"forwardTo": [
162+
{
163+
"emailAddress": {
164+
"name": "Alex Reed",
165+
"address": "[email protected]"
166+
}
167+
}
168+
],
169+
"stopProcessingRules": True
170+
}
171+
}
172+
)
173+
174+
# Check it out.
175+
pprint(my_new_message_rule)

0 commit comments

Comments
 (0)