Wednesday 21 April 2021

Get User Data using Rest API [Python]


# Installing o365 module
# pip install O365

from O365 import Account

credentials = ('Clien_Id', 'Client_Secret')


account = Account(credentials, auth_flow_type='credentials', tenant_id='Tenant_Id')
if account.authenticate():
print('Authenticated!')


directory = account.directory()
for user in directory.get_users():

print(user)



No comments:

Post a Comment