graph api bulk udpate contact in an organisation from a csv

Pavan Goud 20 Reputation points
2024-05-28T13:53:22.5666667+00:00

Graph api error bulk contact update from a csv

updating the contacts using   self.endpoint_base = 'https://graph.microsoft.com/v1.0/me/contacts' this api throws me an error 2024-05-24 16:24:05,765 - INFO - ClientSecretCredential.get_token succeeded 2024-05-24 16:24:05,767 - INFO - ContactManager initialized successfully 2024-05-24 16:24:05,778 - DEBUG - Starting new HTTPS connection (1): graph.microsoft.com:443 2024-05-24 16:24:06,222 - DEBUG - https://graph.microsoft.com:443 "GET /v1.0/me/contacts?$filter=emailAddresses/any(a:a/address%20eq%20'asdadarew@example.com') HTTP/1.1" 400 None 2024-05-24 16:24:06,223 - ERROR - Failed to search contacts: {"error":{"code":"BadRequest","message":"/me request is only valid with delegated authentication flow.","innerError":{"date":"2024-05-24T20:24:06","request-id":"","client-request-id":""}}

c

API / Permissions name Type Description Admin consent required Status
Microsoft Graph (12)
Microsoft Graph (12)
Contacts.Read Delegated Read user contacts No Granted for
Contacts.Read Application Read contacts in all mailboxes Yes Granted for
Contacts.Read.Shared Delegated Read user and shared contacts No
Contacts.ReadWrite Delegated Have full access to user contacts No Granted for
Contacts.ReadWrite Application Read and write contacts in all mailboxes Yes Granted for
Contacts.ReadWrite.Shared Delegated Read and write user and shared contacts No
OrgContact.Read.All Delegated Read organizational contacts Yes Granted for
OrgContact.Read.All Application Read organizational contacts Yes Not granted
User.Read Delegated Sign in and read user profile No Granted for
User.Read.All Delegated Read all users' full profiles Yes Not granted for
User.Read.All Application Read all users' full profiles Yes Not granted for
User.ReadWrite.All Application Read and write all users' full profiles Yes Not granted for

Reply

0 people have the same question

Edit

Subscribe

 

Outlook | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2024-05-28T15:49:46.6266667+00:00

    You are authenticating via client secret, i.e. using the client credentials flow. This flow is designed to run without a signed in user, thus there is no "/me" endpoint in this scenario. Use /user/{userId}/contacts instead.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Pavan Goud 20 Reputation points
    2024-05-28T15:54:01.9366667+00:00
    f'https://graph.microsoft.com/v1.0/users/{user_id}/contacts'
    

    Thanks for responding @Vasil Michev . I used this basically this endpoint this is only updating or creating in my email box none of my colleagues can see it in my organization. please suggest

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.