This GitHub repo contains a Xamarin Visual Studio Project Code Sample that runs in Android Nexus 7 Emulator to show connecting to Contacts Office 365 API.
For this code sample to work you require to have Xamarin installed in your environment. There is a free 30 day trial available on their web site and details on how to install the product. You will need to launch Xamarin Studio and sign in with a trial license or enter a valid license to use Xamarin Projects in Visual Studio.
It is also recommended that you install the GenyMotion Android emulator rather than using the one that comes standard with Xamarin via the Android SDK mainly due to start up time of the emulator. In some scenarios when using the Android SDK you will need to uninstall Hyper-V on your developer environment, which will mean you cannot do native Windows Phone 8.1 emulator development. More details on GenyMotion are available on their web site. This approach will install Oracle VM Virtual Box on your machine.
- Click Connect and sign into Genymotion
- Add a new Virtual Device
- Select Device model and select "Nexus 5" (this is the minimum Android version required for this code sample)
- Wait for the device to initialize
Ensure that "Genymotion Google Nexus" is selected for the Emulator to run in the toolbar.
This code sample will connect to your Office 365 tenant and call the Contacts API. You wlil need to register this mobile device application in Azure AD. To do this:
- right click on the Project and select Add | Connected Service.
- On this screen click "register the application" and use your Office 365 Tenant Admin credentials.
- Once registered you should see the services below, select Contacts and click "Permissions" and check both both and click Apply and then OK.
Your Visual Studio project is now configured against your Office 365 Tenant and the mobile application is registered in Azure AD Applications. For more information on this, please check the Microsoft Virtual Academy Introduction to Office 365 Development Module 5 on "Getting Started with Office 365 APIs".
- In genymotion Start the virtual machine
- Once the VM is running, run the project in Visual Studio by hitting the "F5" key.
- Once the app runs click the "Sign in" button where you'll be prompted for your Office 365 credentials.
- Then you will be prompted with the common consent dialog to confirm the application can access that user credentials Contacts.
Now the app is running successfully.







