In my last post, I was testing the Beta Graph API to get my Teams Presence. The only real challenge I found was understanding the permissions and authentication needed to make it work.
Now that we have validated that we are able to query the presence for the particular user, we proceed to building a tool to further validate the Presence API query and handling the various output. In preparation for our Windows .Net Forms application, we must Register our application in our Azure Active Directory admin center. Learn more about this here. Also to understand the difference between public and confidential client applications, go here. Both are good reading and will provide good background for App Registration options and impact.
We navigate to https://aad.portal.azure.com/
Then, click on
Create a “New registration” and complete the fields.
Click on “Register” when done.
Click on to add the permissions to this App registration.
Then click on “Add a permission“. In the next dialog, click on “Microsoft Graph” and then “Delegated permissions“:
Search and add the following permissions:
- Presence.Read – Read user’s presence information
- Presence.Read.All – Read presence information of all users in your organization
Click on “Add permissions” to Save the changes.
Configure Authentication and Platform Configurations
Click on to configure the platform and add the proper Redirect URIs.
Click on and then the “Mobile and Desktop applications”.
Check and add the following Redirect URIs:
Make sure that the Default Client Type is treated as a Public client.
Be sure to “Save” the changes.
Get the Client ID
Now, click on the Overview menu option.
Be sure to copy the Client ID or Application (client) ID for later use in building the Application.
That’s it for the App Registration. Next, we build a quick prototype tool to prove out our concept.
Another great video here on the Microsoft Graph Auth Overview.