Skip to content

Commit c64c1f0

Browse files
author
Yordy Gelvez
committed
new methods for outlook contacts
1 parent d5a434e commit c64c1f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

microsoftgraph/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class Client(object):
99
AUTHORITY_URL = 'https://login.microsoftonline.com/'
1010
AUTH_ENDPOINT = '/oauth2/v2.0/authorize?'
1111
TOKEN_ENDPOINT = '/oauth2/v2.0/token'
12-
1312
RESOURCE = 'https://graph.microsoft.com/'
1413

1514
def __init__(self, client_id, client_secret, api_version='v1.0', account_type='common'):
@@ -360,6 +359,11 @@ def send_mail(self, subject=None, recipients=None, body='', content_type='HTML',
360359
# Do a POST to Graph's sendMail API and return the response.
361360
return self._post(self.base_url + 'me/microsoft.graph.sendMail', json=email_msg)
362361

362+
# Outlook Contacts Methods
363+
def outlook_get_contacts(self, params=None):
364+
url = "{0}me/contacts".format(self.base_url)
365+
return self._get(url, params=params)
366+
363367
def _get(self, url, **kwargs):
364368
return self._request('GET', url, **kwargs)
365369

@@ -377,7 +381,7 @@ def _delete(self, url, **kwargs):
377381

378382
def _request(self, method, url, headers=None, **kwargs):
379383
_headers = {
380-
'Authorization': 'Bearer ' + self.token,
384+
'Authorization': 'Bearer ' + self.token["access_token"],
381385
'Accept': 'application/json',
382386
'Content-Type': 'application/json'
383387
}

0 commit comments

Comments
 (0)