1
votes

I'm having difficulties getting Microsoft Graph to return two test Contact Folders that I have set up named Test and Test 2.

When I use v1.0:

headers = {'Authorization': 'Bearer ' + token, 'Accept': 'application/json'}
url = 'https://graph.microsoft.com/v1.0/me/contactFolders'
response = requests.get(url,headers=headers)
response_data = response.json()
print(response_data)

I get a blank value in the response:

{
    '@odata.context': "https://graph.microsoft.com/v1.0/$metadata#users('jacobdansey%40hotmail.com')/contactFolders",
    'value': []
}

When I use the Beta, I get this which at least returns something but not what I'm looking for:

{
    '@odata.context': "https://graph.microsoft.com/beta/$metadata#users('jacobdansey%40hotmail.com')/contactFolders",
    'value': [{
        'id': '*ID*',
        'parentFolderId': '*ParentID*',
        'displayName': 'Contacts',
        'wellKnownName': 'contacts'
    }, {
        'id': '*ID*',
        'parentFolderId': '*ParentID*',
        'displayName': 'Skype Contacts',
        'wellKnownName': 'skypecontacts'
    }]
}

I know I am connecting properly because when I ask for just contacts from https://graph.microsoft.com/v1.0/me/contacts, it returns the correct answer.

Any help would be greatly appreciated, thanks!

EDIT: Is there a difference between contact folders and contact lists?

1
Hmm it looks like maybe there's something odd with your account. You're making the right calls but your data isn't right. If you could post the response headers from one of these calls I'll see what I can dig up.Jason Johnston
Just to be sure, are you sure you created new Contact Folders and not new Contact Lists?Marc LaFleur
Not sure, I think I actually created a contact list? I was looking it up for outlook.com and couldn't tell the differenceJake Dansey

1 Answers

0
votes

i am assuming you want access to folder to get the contacts, if thats the case then you can directly get the contacts of that folder changing the get url

https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_contacts