Introduction

The Activity Tracker Sample phone application enables you to connect to your Microsoft Dynamics CRM Online, 2013, or 2015 organization, query for your contacts, and add a quick activity record related to a contact. This sample code demonstrates how to write a Windows 8 phone store app that accesses data in your CRM organization. This app does not make use of any CRM SDK assemblies or classes, which do not support the development of Windows store apps.

Overview

The Microsoft Dynamics CRM 2015 SDK (and earlier releases) supports client and server side code development for Dynamics CRM. However, the SDK assemblies cannot be used to develop mobile and store applications as the Windows run-time (WinRT) is not supported. To provide support for mobile apps, including cross platform iOS and Android apps, the Dynamics CRM server now supports client access to the organization web service using industry standard protocols such as OAuth (for authentication), plus SOAP and OData for sending web service requests. The problem is that while these protocols are supported, they are difficult to use. The solution is to layer a framework on top of the protocols to make app programming easier. For developing mobile and store apps, you can use the Microsoft Azure Active Directory Authentication Library (ADAL) for authentication and a mobile helper code library for web service requests and early-bound type support.

Build and run the sample

Your development computer must have an internet connection to build the sample app as one or more Nuget packages will be automatically downloaded during the app build.

To build and run the Activity Tracker Sample app, follow these steps on a Windows 8 development computer running Visual Studio 2012 or 2013.

  1. Download and build the Mobile Development Helper Code for Dynamics CRM.
  2. Follow the instructions in the topic Walkthrough: Register a CRM app with Active Directory to register the app with Active Directory. You must register the app with a claims enabled CRM deployment, which typically means CRM Online or IFD.
  3. Verify that your CRM server is configured for OAuth authentication. The CRM Online servers are pre-configured. For more information on configuring an IFD server running ADFS 2.0 (or later) see Post-installation and configuration guidelines for Microsoft Dynamics CRM.
  4. Modify the ClientId value on line 68 in the file Helper/ActivityTrackerHelper.cs to match the value used during app registration.
  5. In Visual Studio 2013, with update 2 (or later) installed open the ActivityTracker.sln file.
  6. Add a reference to the project for the Microsoft.Crm.Sdk.Mobile.dll library that you built in step 1.
  7. Press F6 to build the solution, or F5 to build and run.
  8. When prompted by the app, enter your CRM server organization URL on the Settings page and choose Submit. An example URL for CRM Online (North America) would be https://<myOrg>.crm.dynamics.com.
  9. Enter your login credentials if prompted.
  10. A list of your CRM contacts and a search box is shown. You can select a contact from the list to view contact information or do a search for a contact by name.
  11. When the detailed information on the contact is shown, you can optionally add one or more activities to that contact.

There are two NuGet packages that Visual Studio should download during the first build. If this does not happen and build errors result, you can remove those packages using the NuGet package manager in Visual Studio. The packages are named Microsoft.IdentityModel.Clients.ActiveDirectory and Newtonsoft.Json.

About the sample

This sample includes the following key components:

Authentication with the CRM organization web service using ADAL is handled in the file Helper/ActivityTrackerHelper.cs.

Important notes

More Information

For more information on Dynamics CRM authentication and app development, see Write mobile and modern apps.

You can find iOS and Android versions of the basic Activity Tracker sample application on GitHub under the organization DynamicsCRM.

Copyright

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2014 Microsoft Corporation. All rights reserved.

Microsoft, Active Directory, IntelliSense, Microsoft Dynamics, Visual Studio, and Windows are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.