Skip to main content
Skip to main content
Microsoft 365

Office 365 APIs Starter Project for Windows

We’re building a set of starter projects that are intended to help you become familiar with the different Office 365 client libraries on the platforms you care about. In each project, we’ll show you how to use the client libraries to integrate your users’ Office 365 data into your app.

Using the Office 365 client libraries can simplify your life greatly as you code against the Office 365 APIs from your app. Here are just a few  examples:

  • Use the client libraries’ authentication business logic for getting the client access token. This means you don’t have to implement the authentication, authorization, and consent workflow that’s required for OAuth.
  • The client libraries remove the requirement to implement JSON serialization/deserialization in to/from objects; they have parity with the service metadata description; they manage the client access token; and they can make the object model easier to use.
  • Using the client libraries, you can leverage the Office 365 services to access your users’ calendar, mail, contacts, files, and sites.
  • Use the client libraries’ segmentation of feature access and user permissions. This means you can limit the access to specific features (for example, give access to contacts, but not email), as well as limit particular actions (for example, give read-only access).

We just shipped our first starter project to GitHub, Office 365 APIs Starter Project for Windows, and we can’t wait to hear what you think. The sample demonstrates how you can use the Office 365 API client libraries to integrate your users’ Office 365 data into your Windows Store app. Download it today!

Over the coming months we hope to also deliver starter projects for ASP.NET MVC, Android using Eclipse, Android using Xamarin, Cordova and many more. Check back here for updates to this project and announcements of new starter projects.

The Office 365 APIs Starter Project for Windows can help you:

  • Learn how the client libraries provided by Office 365 API Tools are used to make calls that target data stored in Office 365.
  • Build a Windows Store app that integrates your user’s Office 365 data.
  • Learn how to access calendar, files, folders and user information from Office 365.

Let’s take a look at the code in the Office 365 APIs Starter Project for Windows sample. If you haven’t already, we suggest that you download or clone this sample to your desktop and install it. The readme file contains the instructions for setting up the sample so that you can run it against a demo tenant.

Authenticate and get user information

When the sample is launched, you’ll see the screen shown below. Among other things, this page lists the Office 365 services with which you can interact.

MainPage.xaml is where you connect to Office 365

MainPage.xaml is where you connect to Office 365.

From here, you can connect to your Office 365 tenant. The Sign In button triggers a webpage that asks for your consent to allow this application to connect to the services requested by this application. This will get the access token that your application will use to connect to the service. The code we use to connect to the Office 365 services is found in the AuthenticationHelper.cs file. After the user has consented to let the application connect to the Office 365 services, we get the signed-in user’s information from Azure Active Directory (note that the Thumbnail feature is not available in this release). This work is carried out in the UserOperations.cs file.

Calendar API: Create, read, update and delete calendar events from your Office 365 calendar

Select the Calendar button on the start page to launch the Office 365 Calendar API example page, to work with your calendar events stored in Office 365. This is shown in the image below.

Calendar.xaml is where you access Office 365 events

Calendar.xaml is where you access Office 365 events.

This page uses the CalendarViewModel.cs and EventViewModel.cs files to access calendar information stored in your calendar. Look at CalendarOperations.cs to learn how you can:

  • Get the list of calendar events
  • Create a new event
  • Update an existing event
  • Remove an event from your calendar.

My Files API: Create, read, update and delete your files stored in SharePoint

Select the Files button from the start page to launch the Office 365 Files API example page, to access your files and folders in Office 365. You can see this in the image below.

MyFiles.xaml is where you access Office 365 files and folders

MyFiles.xaml is where you access Office 365 files and folders.

This page uses the FilesViewModel.cs and FileSystemItemViewModel.cs to access files and folder information stored in SharePoint. Look at FileOperations.cs to learn how to make calls to:

  • Get a list of all the files and folders in your default documents directory and sub-directory.
  • Create a simple text file.
  • Upload a file to SharePoint.
  • Delete a file or folder.
  • Read the contents of text file.
  • Update the contents of a text file.
  • Download a file. The code to then open the file is located in FilesViewModel.cs.

Questions and comments

Stay tuned to this blog for more updates and information about Office 365 development. We’d love to get your feedback and suggestions on this solution!

You can send your questions and suggestions to us:

  • Here, in the comments section on this blog post. Scroll down to the Join the conversation section.
  • In the Issues section of our GitHub repository for this project.
  • In StackOverflow. Make sure your questions/comments are tagged with [Office365] and [API].

Additional resources

Office 365 APIs Starter Project for Windows, repository on GitHub

Office 365 APIs Preview documentation

Files REST API in Office 365 APIs Preview

Calendar REST API in Office 365 APIs Preview

Office 365 API tool for Visual Studio 2013–update 3

Office Dev Center



You may also like these articles

Image for: Small business professional working on designs using devices running PowerPoint and Microsoft Teams.

Power your digital transformation with insights from Microsoft Productivity Score

Editor’s Note: The Mechanics video embedded in this blog post has been updated to reflect some of the product changes announced on December 1, 2020. For some time now, business leaders have made digital transformation a priority. But when the pandemic hit this spring, adopting and embracing digital technology went from being a matter of…

Image for: A man is using his Lenovo laptop like a tablet while sitting in a comfortable chair in a Modern office setting

Microsoft Productivity Score and personalized experiences—here’s what’s new to Microsoft 365 in October

As I reflect on an action-packed few weeks, I’m struck by how much work has evolved in these past months. And I know our customers feel it too. After quickly moving to remote and hybrid work models this spring, organizations are now seeking sustainable ways to help people collaborate, be productive, and prioritize their wellbeing…

Image for: Microsoft employees working remotely.

Working remotely during challenging times

A Shanghai-based Microsoft employee shares lessons of working remotely during the COVID-19 outbreak.