Demonstrates how to use the Microsoft Graph as the only back-end component for a complete property management solution.
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Microsoft Graph Property Manager Sample for Xamarin Native

Table of contents

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.

The samples uses the Microsoft Authentication Library (MSAL) for authentication and the MvvmCross library to bring the MVVM pattern across platforms with Xamarin.

Screenshots of the sample running on Android, iOS and UWP project.

Project

Project Author(s)
XamarinNativePropertyManager Simon Jäger (Microsoft)

Version history

Version Date Comments
1.0 August 4th 2016 Initial release
1.1 April 4th 2018 Updated to use MSAL library for auth

Prerequisites

This sample requires the following:

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
  • Xamarin.iOS

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.

  1. Sign in to the Application Registration Portal.
  2. Choose Add an app.
  3. Enter a name for the app and choose Create.
  4. Choose Add Platform, then choose Native Application.
  5. 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.

  1. Open the Constants.cs file inside the XamarinNativePropertyManager (Portable) project of the solution.

    Screenshots of the Constants.cs file.

  2. 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.

    Screenshots of the Authority property in the Constants.cs file.

  3. 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.

    Screenshots of the ClientId property in the Constants.cs file.

  4. 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.

  5. Open the XamarinNativePropertyManager.iOS/Info.plist file. Select the Advanced tab and locate the URL Types section. Replace [CLIENT_ID] with your client ID.

    A screenshot of the URL Types section of the Info.plist file

  6. 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.

    Screenshot of the Visual Studio toolbar, with UWP selected as the start-up project.

  7. 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.

Platform screenshots

Android

Sample running on Android.

iOS

Sample running on Android.

UWP

Sample running on Android.

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.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Additional resources

Copyright

Copyright (c) 2016 Microsoft. All rights reserved.