Skip to main content

affliction

Project description

affliction

welcome to affliction. provides synchronous clients, based on deceit, for interacting with the microsoft graph api and the exchange management rest api. please be mindful that the exchange rest api is (still, as of 2023 after more than three years) in beta, and these apis are not currently published.
this means that the exchange rest api will likely change between the time that this library is published and the time the exchange management rest api is officially released.

powered by angry penguins.

graph client

to use the graph client, you use the affliction.graph_client.SynchronousGraphClient class. there are a few pre-defined endpoints for now for users and subscribedSkus.

from affliction.graph_client import SynchronousGraphClient
client = SynchronousGraphClient(
    tenant_id='01234567-000...',
    client_id='01234567-000...',
    client_secret='secret generated from azure app registration',
)
users = client.get_users(params={
    '$search': '"displayName:alice"',
})

documentation for the users endpoint is available from micrososft. other documents provide a more fulsome description of the available odata parameters

exchange client

to use the exchange client, instantiate affliction.exchange_client.ExchangeClient

use the mailboxes endpoint with $filter or $search odata semantics just like you would with the graph api.

from affliction.exchange_client import ExchangeClient
client = ExchangeClient(
    tenant_id='01234567-00...',
    client_id='01234567-00...',
    client_secret='app secret from azure app registration with Exchange.ManageAsApp permissions'    
)
mailboxes = client.mailboxes(params={
    '$search': '"displayName:catsareawesome"',
})
recipients = client.recipients(params={
    '$filter': 'LitigationHoldEnabled eq True',
})

hat tip to Vasil Michev who got us started down this path:
https://www.michev.info/blog/post/2869/abusing-the-rest-api-endpoints-behind-the-new-exo-cmdlets

to see how to add the required ManageAsApp permission, please feel free to reference this link: https://4sysops.com/archives/connect-to-exchange-online-with-powershell-and-certificate-based-authentication/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

affliction-1.2.tar.gz (10.7 kB view details)

Uploaded Source

File details

Details for the file affliction-1.2.tar.gz.

File metadata

  • Download URL: affliction-1.2.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.10

File hashes

Hashes for affliction-1.2.tar.gz
Algorithm Hash digest
SHA256 5e5e400c9ee9048bbabdf13eb5e7031bde1ebe09fe1c8140d10662d789a8b45d
MD5 f8e9fc4c08767236002bf2ab6844a35d
BLAKE2b-256 d8ec2b11c9d70a8a3103cbbcf8429f7020cd64ec3ae4f21a67cbed47606fe4e9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page