Use the Powell Governance API within ASP.NET with C#

We are thrilled to share with you that Powell Teams is now Powell Governance, marking our expanded focus on Microsoft 365!

Powell_Governance_V1 1.png

Expect documentation to be reflect this change in the coming days. For more information, please have a look at this article.

If you want to implement your custom .Net Application targeting our public API, you can use the starter project attached. You can find the ZIP file at the end of the article.  



  1. Setup 

Authentication flow in the given project is based on the OAuth 2.0 authorization code flow  

For this authentication flow to work, you will need to create an Azure AD application to authenticate your requests, with the following delegated scopes: 

  • Directory.AccessAsUser.All 
  • Group.ReadWrite.All 
  • Notes.Read.All 
  • Notes.ReadWrite.All 
  • Sites.Read.All 
  • User.Invite.All
  • User.Read
  • User.Read.All 

To do so, refer to the following documentation:  


Don’t forget to configure the app with the redirect URLs based on your web application url: 



Once the app is created in Azure AD, locate the launchsettings.json file in the project to update the ClientSecret and ClientId keys. 




       2. How it works in code 


Once everything is configured, and the project is launched, the HomeController will redirect the user to the Azure AD login page.  




Once the user logs in, the user will be redirected to the AuthorizationController, with a code to redeem the authentication. Then the AuthorizationController will redirect the user back to the HomeController. 




Call the API 

Once authenticated, you will be able to call the Powell Governance API endpoints with classic .Net code, such as: 



Note the SetHeaders method that is mandatory in order to pass the authentication token in the Authorization header to the Public API: 



Was this article helpful?
0 out of 0 found this helpful