@@ -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,30 @@ 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_me_contacts (self , data_id = None , params = None ):
364+ if data_id is None :
365+ url = "{0}me/contacts" .format (self .base_url )
366+ else :
367+ url = "{0}me/contacts/{1}" .format (self .base_url , data_id )
368+ return self ._get (url , params = params )
369+
370+ def outlook_create_me_contact (self , ** kwargs ):
371+ url = "{0}me/contacts" .format (self .base_url )
372+ return self ._post (url , ** kwargs )
373+
374+ def outlook_create_contact_in_folder (self , folder_id , ** kwargs ):
375+ url = "{0}/me/contactFolders/{1}/contacts" .format (self .base_url , folder_id )
376+ return self ._post (url , ** kwargs )
377+
378+ def outlook_get_contact_folders (self , params = None ):
379+ url = "{0}me/contactFolders" .format (self .base_url )
380+ return self ._get (url , params = params )
381+
382+ def outlook_create_contact_folder (self , ** kwargs ):
383+ url = "{0}me/contactFolders" .format (self .base_url )
384+ return self ._post (url , ** kwargs )
385+
363386 def _get (self , url , ** kwargs ):
364387 return self ._request ('GET' , url , ** kwargs )
365388
0 commit comments