Chakkaradeep Chandran and Saurabh Bhatia are program managers for Visual Studio.
The client libraries will let you:
Perform authentication and discovery
Use the Mail, Calendar and Contacts API
Use the Users and Groups API
Here are some examples of how easy it is to access the Office 365 APIs using these libraries.
.NET C# code to authenticate and get upcoming events from your Office 365 calendar:
// Shows UI to authenticate
Authenticator = newAuthenticator();
AuthenticationInfo result = await authenticator.AuthenticateAsync(“https://outlook.office365.com”);
The AuthenticateAsync method will prompt for a username and password and authenticate against the specified resource URL, like outlook.office365.com in this case. Once you have the authentication information, you can create a client object that serves as the base for accessing all the APIs for Exchange:
Because we’re using .NET here, we get to take advantage of the native language capabilities, like LINQ, so querying the Office 365 calendar is as simple as writing a LINQ query and executing it:
// Obtain calendar event data
var eventsResults = await (from i in client.Me.Events
where i.End >= DateTimeOffset.UtcNow
With just those four lines of code, you can start making calls to the Office 365 APIs!
We wanted to make sure that you can reach multiple device and service platforms with a consistent API, so the client libraries are portable .NET libraries, which means they also work with Android and iOS devices through Xamarin. Because authentication needs to display a UI that is different on the various platforms, we also provide platform-specific authentication libraries, which can then be used with the portable ones to provide an end-to-end experience. Note that while we tend to call these “client” libraries, these also work with .NET server technologies like Asp.Net Web Forms and MVC, so you really get to target the breadth of the .NET platform.
As you get started using these libraries, there are a few things to keep in mind. This is a very early preview release of the libraries that are meant to prove the concept and get feedback on it. The libraries do not currently cover all the APIs provided by the services, and some of the APIs in the library may not work. The APIs in the libraries themselves will change in future updates. We want your feedback on what you like or don’t like about the ways the APIs are exposed. We have made some assumptions here—for example, with the way paging works or how the authentication library is currently implemented—that may not work best for you, so we’d like to hear from you on how you want to use these libraries in your apps to help us shape the libraries appropriately.
You can provide feedback by joining the conversation on StackOverflow. Tag your questions and feedback with Office 365 APIs.
With today’s update of our Office 365 API Tools for Visual Studio 2013, the tool displays the available Office 365 services that you can add to your project. Once you’ve signed in with your Office 365 credentials, adding a service to your project is as easy as selecting the appropriate service and applying for the required permissions.
Once you submit the changes, Visual Studio performs the following:
Registers an application (if there isn’t an application registered yet) in Microsoft Azure Active Directory to consume Office 365 services.
Adds the following to the project:
Client libraries from Nuget for the configured services.
Sample code files that use the Client Libraries.
Project types supported
With the broad reach of the client libraries, the Office 365 API tool is now available for a variety of project types (client, desktop, and web) in Visual Studio. Here’s are all the project types supported with the May update:
.NET Windows Store Apps
Windows Forms Application
ASP.NET MVC Web Application
ASP.NET Web Forms Application
Xamarin Android and iOS Applications
Multi-device hybrid apps
Installing the latest update
To install the latest update, you can either:
Check for updates within Visual Studio. To do so, follow these steps:
In Visual Studio menu, click Tools->Extensions and Updates->Updates.
You should see the update available for Office 365 API Tools.
Once you’ve updated, you can invoke the Office 365 API tool, as usual, that is, by going to your project node in the Solution Explorer and selecting Add->Connected Servicefrom the context menu.
We’re excited to get this release out and hope this greatly simplifies the experience of using Office 365 APIs. We plan to continue providing regular updates to the Office 365 API Tools and these libraries.