Microsoft Graph Property Manager Sample for Xamarin Native
Table of contents
- Register and configure the app
- Build and debug
- Run the sample
- How the sample affects your account data
- Additional resources
This sample project demonstrates how to use the Microsoft Graph as the only back-end component for a complete property management solution. The samples covers features such as property details, conversations, files and tasks in a Xamarin Native app.
The purpose of this sample is to demonstrate the ability to create platform user interfaces and experiences (by implementing native views), while sharing common code across platforms and supercharging the solution with the Microsoft Graph. It heavily leverages Office 365 groups in order to organize data into properties.
Note The sample targets the beta branch of the Microsoft Graph, which the Microsoft Graph .NET Client SDK does not implement. Instead, network calls are being made with the built in HTTP stack towards the Microsoft Graph to consume its resources.
|XamarinNativePropertyManager||Simon Jäger (Microsoft)|
|1.0||August 4th 2016||Initial release|
|1.1||April 4th 2018||Updated to use MSAL library for auth|
This sample requires the following:
- Visual Studio 2017 with the Xamarin workload installed
- Windows 10 (development mode enabled)
- An Office 365 account - If you are building for Office 365 and you're missing an Office 365 tenant - get yourself a developer account at: https://developer.microsoft.com/en-us/office/dev-program.
If you want to run the iOS project in this sample, you'll need the following:
- The latest iOS SDK
- The latest version of Xcode
- Mac OS X Yosemite (10.10) & above
You can use the Visual Studio Emulator for Android if you want to run the Android project.
Register and configure the app
The first thing you need to do is to register your app in the Application Registration Portal.
- Sign in to the Application Registration Portal.
- Choose Add an app.
- Enter a name for the app and choose Create.
- Choose Add Platform, then choose Native Application.
- Choose Save.
Build and debug
Note: If you see any errors while installing packages during step 2, make sure the local path where you placed the solution is not too long/deep. Moving the solution closer to the root of your drive resolves this issue.
Open the Constants.cs file inside the XamarinNativePropertyManager (Portable) project of the solution.
After you've loaded the solution in Visual Studio, configure the sample to use your Azure AD tenant by replacing the [TENANT_ID_OR_NAME] value in the Authority property in the Constants.cs file.
Configure the sample to use your Azure AD application Client Id by replacing the [CLIENT_ID] value in the ClientId property in the Constants.cs file.
Open the XamarinNativePropertyManager.Droid/Properties/AndroidManifest.xml file. Replace the
[CLIENT_ID] value with your client ID.
Note: If you're using Visual Studio for Mac, be sure to click the Source tab after opening AndroidManifest.xml.
Open the XamarinNativePropertyManager.iOS/Info.plist file. Select the Advanced tab and locate the URL Types section. Replace
[CLIENT_ID]with your client ID.
Select the project that you want to run. If you select the Universal Windows Platform project, you must run the sample on a Windows machine. If you want to run the iOS project, you'll need to either connect to a Mac that has the Xamarin tools installed on it, or you'll need to build and run the project in Visual Studio for Mac. The Android project can be built and run on either Windows or Mac as long as the Android emulator is installed.
Press F5 to build and debug. Run the solution and sign in with either your personal or work or school account.
Note You might have to open the Build Configuration Manager to make sure that the Build and Deploy steps are selected for the UWP project.
Run the sample
After launching the app, click the Sign in button to sign in to your organizational account. After you authenticate, the app displays all the properties in your organization. Create a new one by filling in the details and the app will provision a new Office 365 group for this property. At this point you will be able to post messages to the group conversations, add files and create tasks.
You will also be able to update the details of the property and create new ones. Explore the Office 365 groups in your browser to find all of the data used within the app. The property details are stored in an Excel workbook named Data.xlsx, located in the Property Managers group.
How the sample affects your account data
When this sample is started for the first time (in the Office 365 tenant) an Office 365 group named Property Managers is created. In this group, a Data.xlsx file is stored which hosts all of the details for the different properties.
For each property that is created within the app, a new Office 365 group is provisioned. In each group the files, conversations and tasks resources are used by the app. Tasks are the only thing that can be deleted (completed) from within the app. The app does not provide an ability to delete conversation posts or files.
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
- Other Microsoft Graph Connect samples
- Microsoft Graph overview
- Office developer code samples
- Office dev center
- Simon Jäger's blog on #Office365Dev
Copyright (c) 2016 Microsoft. All rights reserved.