Skip to content

Instantly share code, notes, and snippets.

View mvelazc0's full-sized avatar

mvelazco mvelazc0

View GitHub Profile
@mvelazc0
mvelazc0 / create_inbox_rule_ews.py
Created April 12, 2024 16:23
Create an inbox rule on an M365 mailbox using the EWS API
import requests
tenant_id = ''
client_id = ''
client_secret = ''
scope = 'https://graph.microsoft.com/.default'
token_url = f'https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token'
token_data = {
@mvelazc0
mvelazc0 / modify_folder_permissions_ews.py
Created April 15, 2024 16:23
Modify folder permissions on an M365 mailbox using the EWS API
import requests
from xml.etree import ElementTree as ET
def create_find_folder_soap_request(mailbox, folder_name):
folder_name = str.lower(folder_name)
return f'''<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"