An Office 365 Developer Tenant is a great resource for developing with the Office 365 REST APIs. It gives you a place to register your app, and a user to test against. However, you have to manually add data to your user’s mailbox or OneDrive. Today we’re excited to announce a sample Windows Store App project that will populate data for Office 365 API services such as mail, calendar, contact and files. Not only do you automate the process of getting test data into your developer tenant, but you get some sample code for creating items!
The app works by reading new contacts, mails and calendar events from an XML file and adding them to the logged in Office 365 user’s account. For files, you browse and select one or more files from your computer and the app uploads them for you. Existing data on the Office 365 tenant account will not be affected by this app.
You can use this app to quickly populate data into your Office 365 developer tenant so you can get started building Office 365 apps by interacting with the populated data. Let’s take a look at how it works.
Get the sample
Before you start, make sure that you have the needed tools. You’re going to need:
- Visual Studio 2013
- Office Developer Tools for Visual Studio 2013
- An Office 365 Developer tenant (or any Office 365 test user will work)
The sample is hosted on GitHub here: https://github.com/OfficeDev/O365API-PopulateSampleData. Download or clone the repository and open it up in Visual Studio. The README contains all of the details on configuring the project to run on your machine. Go ahead and follow Step 1 and Step 2.
Customize the data
Step 2 in the README introduce you to the XML files that contain the sample data for mail, calendar, and contacts. They contain a few sample entries to get you started, but you can add as many more as you like. One important detail that’s easy to miss is that for mail, the app adds mails by sending them as you. So to have them show up in your Inbox, make sure that you add your email address to the ToRecipients entries.
You’ll browse for files in the app itself, so there’s no XML file for files. For convenience you may want to generate some test files in a single directory.
Run the sample App
Press F5, to run the app. This is how the application looks:
Now you can click the buttons to add data to your user. The first one you choose will prompt you to login.
Add Files to OneDrive
When you click “Add MyFiles”, you’ll get a browse window to select files. Once you select the files you want and click Open, the app will upload them to the user’s OneDrive.
Add Mail, Events, or Contacts
Adding mail, events, or contacts is as easy as clicking the corresponding button. The app will parse the corresponding XML file and create new items for each entry. After it’s done, it will show a list of the current items of the appropriate type.
Besides populating data, the app can also update or delete data. The README on GitHub has instructions for updating the XML files for update or delete.
We hope that you find this app useful! Please report issues on GitHub.