in Office 365, Office 365 API

Update to Office 365 API Tools and Client Libraries

Today at TechEd Europe, Microsoft announced the general availability of Office 365 APIs which means the Office 365 API Tools and the Client Libraries have also RTMed!

Updating the Tools

If you already have the tools installed, look out for an update notification in Visual Studio.

If you can’t wait to update, then you can go ahead, download and update the tools here!

Updating the Client Libraries

Along with updating the tools, you should also update the client libraries if you are already using the libraries in an existing project. Just go to NuGet Package Manager and look out for updates to the Office 365 API Client Libraries and update them all.

Since you are moving from Preview, it is always advised that you remove all the Office 365 API NuGet packages and then install them via Office 365 API Tools.

Few notable changes 

  • Azure Active Directory Graph library has undergone a name change. So, if you are already using the AAD Graph library, you  may want to uninstall the previous version and install the latest version.
  • There has been quite few namespace changes, so look out for them when building the project.
  • ExchangeClient is now OutlookServicesClient
  • There is a new client for the Office 365 Discovery Service called DiscoveryClient
  • The tools no longer adds sample code files to your project, instead redirects to the documentation portal where you will have instructions on how to write code against Office 365 APIs.
    • Note: This document will be updated from time to time to reflect new information/updates.

Changes to Authentication Library

This is probably the biggest change you will notice. The libraries no longer have specific implementation for authentication.

You can use Active Directory Authentication Library to write code to authenticate against Windows Azure Active Directory.

To get started, you can view the awesome samples ADAL team has already published to GitHub – Here are a few that might interest you:

  1.  WebApp-WebAPI-MultiTenant-OpenIdConnect-DotNet (replace the WebAPI calls to Office 365 API)
  2. WebApp-WebAPI-OpenIDConnect-DotNet
  3. WebApp-WebAPI-OAuth2-UserIdentity-DotNet (replace the WebAPI calls to Office 365 API)
  4. Client Applications Samples

Office Developer GitHub will also be updated with samples. Here is the first one that I published

Office 365 API MultiTenant Web Application

This sample shows how to build an MVC web application that uses Azure AD for sign-in using the OpenID Connect protocol, and then calls a Office 365 API under the signed-in user’s identity using tokens obtained via OAuth 2.0. This sample uses the OpenID Connect, ASP.Net OWIN middleware and ADAL .Net.

Updates to and MSDN

There has been some great updates to Office Dev Center and MSDN documentation.

Make sure you visit these links for some useful content:

As usual, do leave your comments and feedback if any!

Go Office 365 APIs! 🙂

Write a Comment


Time limit is exhausted. Please reload the CAPTCHA.


  1. Great article, thanks Chak!

    Important to notice is, if you used the alpha, switch to the new authentication and reuse your application client id from azure, u will receive an exception (unauthorized) if you try to get the capabilities.

    You have to create a new application in azure, to make it work.


    • Thanks Lars. You shouldn’t need to change the client Id. Can you take a fiddler trace to see to what resource you are getting an unauthorized exception?

      • Hi Chak, sorry for the late answer here is the call and response we are getting while using the old azure application. (with the new azure application instance all is working as expected, same rights).

        Call goes to:
        Response: {“error”:{“code”:”-2147024891, System.UnauthorizedAccessException”,”message”:”Access denied. You do not have permission to perform this action or access this resource.”}}


  2. Hi Chak,

    we are getting the following exception, using the new files api.

    {“error”:{“code”:”-2147024891, System.UnauthorizedAccessException”,”message”:”Access denied. You do not have permission to perform this action or access this resource.”}}

    We set the consent for sharepoint in azure, but still getting this message. Any Ideas?


  3. Hi ,

    I have a sharepoint provider hosted MVC app, i was using the code along with preview below

    var discoveryContext = await DiscoveryContext.CreateAsync();
    var refreshToken = new SessionCache().Read(“RefreshToken”);
    var creds = new ClientCredential(discoveryContext.AppIdentity.ClientId, discoveryContext.AppIdentity.ClientSecret);
    return new ExchangeClient(
    async () => (await discoveryContext.AuthenticationContext.AcquireTokenByRefreshTokenAsync(refreshToken, creds, ServiceResourceId)).AccessToken);

    I have updated all the nuget packages and o365 API tools. Where can i find the new code samples for a sharepoint provider hosted app.

  4. Hi Chak we encountered another Problem using the new Client API.
    We just can’t request files. We do as it is provided in the examples.

    – AcquireTokens works, we get a JWT which seems to contains the needed rights.
    – We are getting a SharepointClient
    – We do the following request: await Authenticator.SharePointClient.Files.ExecuteAsync();

    And get the following exception thrown:
    “Access denied. You do not have permission to perform this action or access this resource.”

    If we do a normal request via the browser against the uri against: it works fine.

    Do you have any ideas why the web request works, but the .net client api request fails?


    • The browser based access uses session based cookie.. so it’s not a valid comparison to OAuth based access that SDK uses..
      To address your issue – can you first ensure that your App has right access (set in Azure Management Portal) to read/write. Then ensure the SharePoint client is created correctly.. I can’t find an obvious reason. I can point to this GitHub project that does work.. Though its Win8.1, it is still relevant since the client creation part is similar.

      Let us know if you continue to face this issue..

      • Hi Sudhi,

        as i describe in my post above we are already an application in azure managment, the application has the following rights:

        Edit or delete users’ filesHelp
        Read users’ filesHelp

        We already have as well a SharePoint client which looks fine so far.

        Since the Office365StarterProject was updated a few days ago and it now contains an SharePointClient/Files Example as well, i just downloaded it. Added the RedirectUri to our Application in Azure, replaced the ClientID and the CommonAuthority with our values.

        private static readonly string ClientID = “04174874-b38e-4e14-8f90-56dece12a847”;
        private static readonly string CommonAuthority = “” + @”/Common”;

        The login works fine as soon as i try to get some files we encounter exactly the same error message as described above.

        Any other ideas?


  5. hi Chaks,

    We are using Azure Active Directory Graph Client Library in an Azure project which in time will also use O365. We updates our refs to use the new 2.0 version and it broke our code… see details here

    My question: can we use the new version without the O365 stuff and do you have some guidance or samples on how to use the new version? we basically want to query the graph api for group memberships, sku’s and profile AD details…

    , Xavier


  • Changes to Office 365 API Authentication Library in the Summer Update – Chaks Corner January 15, 2016

    […] Update to Office 365 API Tools and Client Libraries […]

  • The Ultimate Link Roll for Getting Started with Office 365 APIs – Chaks Corner January 15, 2016

    […] that Office 365 APIs are generally available, you would want to go integrate Office data into your applications and are looking for resources […]

  • New Office 365 extensibility for Windows, iOS, Android and web developers | Lync Nerd January 15, 2016

    […] @chakkaradeep has a nice write-up on the release as well that explains how to update your tools if you already have them along with a […]