##Table of contents
- Prerequisites
- Register and configure the app
- Build and debug
- Run the sample
- How the sample affects your account data
- Add a snippet
- Questions and comments
- Contributing
- 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.
The samples uses the Active Directory Authentication Library for authentication and the MvvmCross library to bring the MVVM pattern across platforms with Xamarin.
Project | Author(s) |
---|---|
XamarinNativePropertyManager | Simon Jäger (Microsoft) |
Version | Date | Comments |
---|---|---|
1.0 | August 4th 2016 | Initial release |
This sample requires the following:
- Visual Studio 2015
- Xamarin for Visual Studio
- 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: http://dev.office.com/devprogram
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
- A Xamarin Mac agent connected to Visual Studio
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 Azure AD.
- Sign in with an administrative user of your Office 365 tenant at the Azure Management Portal.
- Select Active Directory.
- Select your Azure AD tenant in the Directory tab.
- Click on Applications in the tab menu.
- Click on the Add button at the bottom.
- Choose Add an application my organization is developing in the dialog that shows up.
- Name your application and select Native Client Application.
- Enter a Redirect Uri. You can use anything for this, for example "https://propertymanagerapp".
- When the application has been created, click on the Configure tab in the application page.
- Scroll down to the bottom to the Permissions to other applications section and click on the Add application button.
- Show Microsoft Apps and add the Microsoft Graph.
- Save your changes by clicking the check button at the bottom.
- Click on Delegated permissions and pick the following permissions:
- Sign users in
- Read and write all groups
- Read items in all site collections
- Have full access to all files user can access
- Create, read, update and delete user tasks and projects (preview)
- Read directory data
- Save your configuration by clicking the Save button at the bottom.
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.
-
Configure the sample to use your Azure AD application Redirect Uri by replacing the [REDIRECT_URI] value in the RedirectUri property in the Constants.cs file.
-
Select the project that you want to run. If you select the Universal Windows Platform option, you can run the sample on the local machine. If you want to run the iOS project, you'll need to connect to a Mac that has the Xamarin tools installed on it. (You can also open this solution in Xamarin Studio on a Mac and run the sample directly from there.) You can use the Visual Studio Emulator for Android if you want to run the Android project.
-
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.
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 |
iOS |
UWP |
##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.
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.
- 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.