Forum Discussion

DanLocks's avatar
DanLocks
Qrew Trainee
2 years ago

Microsoft Graph API in a pipeline

Has anyone connected to the Microsoft Graph API from a pipeline? 

I need access to some outlook data that doesn't come through with the methods provided by the Outlook channel. Specifically the "New Time Proposed" values for calendar item updates. The graph API provides the information I need in a straightforward way.

 I'm having trouble getting authenticated. I've provisioned everything correctly, and can use the client_id client_secret values in Postman. However when used in the pipeline, no token is being provided. The error coming back from the pipeline is... not illuminating.



------------------------------
Dan Locks
------------------------------
  • For posterity:

    There is currently a bug in the webhook oauth2 authentication. it won't work if you need to provide a scope.

    I ended up building a pipeline That authenticates itself.  It's rather a hack, but.. it works. like this:

    1. trigger on new outlook email in shared mailbox, filter: subject starts with "new time proposed"
    2. fetch JSON from the MS oauth2 authentication service (https://login.microsoftonline.com/{tenantID}/oauth2/v2.0/token) to get a token (grant_type=client_credentials , scope=https://graph.microsoft.com/.default)
    3. use the token in another fetch JSON to https://graph.microsoft.com/v1.0/users/{shared_mailbox_from_step_1}/messages/{{a.id}}
    4. Process the json to get the proposedNewTime values.

    Functional, but kinda ugly.



    ------------------------------
    Dan Locks
    ------------------------------