If you set up a SharePoint site using SharePoint Online or SharePoint on-premises, you can embed Microsoft Dynamics NAV in an app on the site. You can create an app that opens Microsoft Dynamics NAV Web client in a new browser tab, and you can display Microsoft Dynamics NAV data in hosted app parts in the SharePoint site. Building and deploying apps for SharePoint requires that you create the app in Visual Studio and add it to the SharePoint site. After you have built your app, you can make it available to other sites, such as subsites in your site collection. For example, if you provide financial services to several customers, you can set up a site collection with a subsite for each subscriber. You can then create and deploy an app for SharePoint that displays each subscriber’s Microsoft Dynamics NAV data in their SharePoint site. You can create an app for SharePoint that will display different pages in Microsoft Dynamics NAV Web client as hosted app parts.
This topic describes the overall configuration of an app for SharePoint that uses Microsoft Dynamics NAV data with examples of what you are likely to have to do.
Getting Started
If you already have a site available on SharePoint Online, you can deploy your first app to that. Alternatively, sign up for a free trial Office 365 plan. We recommend that you use a plan such as Office 365 Enterprise E1 as your test site, or that you sign up for a trial developer plan. A trial plan includes an administrative account which you will use to set up the app in the SharePoint site. For example, if your Office 365 site is Solutions.onmicrosoft.com, your administrative account can be admin@solutions.onmicrosoft.com. For more information, see Select an Office 365 plan for business.
As part of a SharePoint Online subscription, you also get a Windows Azure Active Directory (Windows Azure AD) tenant. The Windows Azure AD tenant handles user authentication when users sign in to SharePoint Online. To enable a seamless integration between SharePoint Online and Microsoft Dynamics NAV, you must configure Microsoft Dynamics NAV to authenticate users against the same Windows Azure AD tenant. This will enable single sign-on between the two applications, so that users will only have to sign in once. Also, Microsoft Dynamics NAV web parts that are embedded on SharePoint pages will work. You can work with Windows Azure AD management in the Windows Azure Management Portal, or you can use Windows Azure Active Directory Module for Windows PowerShell cmdlets. For more information, see Authenticate Users with Windows Azure Active Directory.
If you want to use your app in a SharePoint on-premises deployment, you must choose a solution that meets your requirements. For example, the App Catalog is not available in all SharePoint 2013 on-premises solutions.
You will also need tools to create the actual app. We recommend that you use the latest version of Visual Studio 2012 with the Microsoft Office Developer Tools for Visual Studio 2012. You do not have to write code to create the app, but Visual Studio 2012 includes project templates for creating apps for SharePoint, which makes it less complex. For more information, see Microsoft Office Developer Tools for Visual Studio 2012 online.
You must have Microsoft Dynamics NAV installed and running with Microsoft Dynamics NAV Web Server components configured to use secure authentication and SSL. For more information, see How to: Configure SSL to Secure the Connection to Microsoft Dynamics NAV Web Client.
Configuring Microsoft Dynamics NAV
The Microsoft Dynamics NAV Server instance that you want your app for SharePoint to access must be configured to use AccessControlService as the credential type. For more information, see Authenticate Users with Windows Azure Active Directory.
The Microsoft Dynamics NAV Web Server components instance that you want to use for your app for SharePoint must be configured to be able to run in the SharePoint site. The default configuration prevents the Microsoft Dynamics NAV Web client from running inside an iframe in an external website. If you want to show Microsoft Dynamics NAV data in app parts, you must remove the X-FRAME-OPTIONS setting in the web.config file. For more information, see Embedding Microsoft Dynamics NAV Web Client Pages in Other Websites.
Each user who will access Microsoft Dynamics NAV from your app for SharePoint must be set up in Microsoft Dynamics NAV. For example, create the users with Windows authentication or with user name/password authentication, depending on your deployment scenario. But you must also specify an authentication email address on the Office 365 Authentication FastTab in the User Card window. The authentication email address must be the same account that the users log on to Office 365 or SharePoint Online with. If you set up this account in your Windows Azure AD tenant, you achieve a deeper integration between SharePoint and Microsoft Dynamics NAV. By creating the users of the SharePoint site as users in Microsoft Dynamics NAV with this authentication email address, they achieve single sign-on when they access Microsoft Dynamics NAV Web client from the SharePoint site, for example. For more information, see How to: Create Microsoft Dynamics NAV Users.
Registering the App in SharePoint
Before you can install the app on a SharePoint site, the app must be registered in SharePoint. There are five ways that you can register an app. The route that you choose depends on your scenario and environment. For more information, see Guidelines for registering apps for SharePoint 2013 in the MSDN Library.
In this scenario, you register the app manually because you will install the app on your own SharePoint sites only. You must access the appregnew.aspx page for your subscription, such as https://MyTenant.sharepoint.com/_layouts/15/appregnew.aspx
and register your app. The following table describes the result of registering an app.
Field | Description |
---|---|
App Id | A GUID, such as 2de23703-bbb9-4542-970d-84b6e5597f53. This is also referred to as the client ID. |
App Secret | A base-64 encoded string, such as xvVpG0AgVIJfch6ldu4dLUlcZyysmGqBRbpFDu6AfJw=. This is also referred to as the client secret. |
Title | The name of the app, which will be shown to users of your site, such as Financial App by Solutions. |
App Domain | The host name for your Microsoft Dynamics NAV Web Server components, such as www.solutions.com. If you have deployed the Microsoft Dynamics NAV Web client on a local machine, you can also enter the machine name. |
Redirect URI | The URI for signing in to your Microsoft Dynamics NAV Web Server components, such as https://www.solutions.com/DynamicsNAV or https://MyComputer/DynamicsNAV. |
Creating the App
With Visual Studio 2012 and the Microsoft Office Developer Tools, you can create an app for SharePoint using the App for SharePoint 2013 project template. For more information, see How to: Create a basic provider-hosted app and Build apps for SharePoint in the MSDN Library.
When you create the project, you must specify the name and location of the SharePoint site as described in the following table.
Field | Description | ||
---|---|---|---|
What is the name of your app for SharePoint? | Specify a name, such as NAVSharePointApp. The name that you specify here is not the name that displays to users of the SharePoint site. | ||
What SharePoint site do you want to use for debugging your app? | Specify the developer site that is part of your Office 365 plan. For example, if your Office 365 plan is Solutions.onmicrosoft.com, your developer site can be Solution.sharepoint.com.
| ||
How do you want to host your app for SharePoint? | Choose Provider-Hosted. |
This creates a new solution in Visual Studio. The solution contains a default project called <project name>Web. You can remove this project because you do not need it to build an app that uses Microsoft Dynamics NAV data. As a result, you have a solution that contains the following files:
-
AppIcon.png
You can replace this file to use an image that is more relevant for your app. -
AppManifest.xml
The app manifest describes the app.
Modify the App Manifest
You must modify settings in the app manifest for the app, such as adding the app ID that you generated from the SharePoint site. You can only add this by opening the app manifest file in code view. In code view, you see the XML elements of the app manifest. You must add the app ID as the value of the ClientId parameter in the RemoteWebApplication
element under the AppPrincipal
element. You must also add the URL to the Microsoft Dynamics NAV Web client configuration as the value of the StartPage
element
The following code example illustrates the content of an AppManifest.xml file:
Copy Code | |
---|---|
<?xml version="1.0" encoding="utf-8" ?> <App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest" Name="NAVSharePointApp" ProductID="{335df4e8-93b1-4205-8504-001aa934b01e}" Version="1.0.0.0" SharePointMinVersion="15.0.0.0" > <Properties> <Title>Financial App by Solutions</Title> <StartPage>https://www.solutions.com/DynamicsNAV/WebClient/?{StandardTokens}</StartPage> </Properties> <AppPrincipal> <RemoteWebApplication ClientId="2de23703-bbb9-4542-970d-84b6e5597f53" /> </AppPrincipal> </App> |
We recommend that you do not set up permissions that your app for SharePoint will request from the user at installation time.
Adding Web Parts to the App
Optionally, you can add client web parts to the project and configure them to show specific Microsoft Dynamics NAV pages in Microsoft Dynamics NAV Web client. This means that the Microsoft Dynamics NAV pages will display inside the SharePoint pages. When you create a client web part, you can specify URLs that display a list page without displaying the ribbon or UI parts. As a result, the page will appear to be just another app part on the SharePoint site, but it is the Microsoft Dynamics NAV Web client. For more information, see Embedding Microsoft Dynamics NAV Web Client Pages in Other Websites
In order to add web parts to the app, add an item of type Client Web Part (Host Web) to the project in Visual Studio. Specify that it must use an existing web page, and then specify use a URL such as https://www.solutions.com/DynamicsNAV/WebClient/List.aspx?mode=View&isembedded=1&page=9301&shownavigation=0&showribbon=0&showuiparts=0&pagesize=7&{StandardTokens}.
You can choose to convert the query parameters into properties on the web part, which will allow you to configure the same web part differently when inserting it on different SharePoint pages.
The following code example illustrates the content of the Elements.xml file for a web part.
Copy Code | |
---|---|
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ClientWebPart Name="ListPart" Title="Microsoft Dynamics NAV List Part" Description="List from Microsoft Dynamics NAV" DefaultWidth="800" DefaultHeight="300" > <Content Type="html" Src="https://www.solutions.com/DynamicsNAV/WebClient/List.aspx?mode=View&isembedded=1&page=_PageId_&shownavigation=0&&pagesize=_PageSize_&{StandardTokens}" /> <Properties> <Property Name="PageId" Type="int" RequiresDesignerPermission="true" DefaultValue="9301" WebCategory="Microsoft Dynamics NAV" WebDisplayName="Page number."> </Property> <Property Name="PageSize" Type="int" RequiresDesignerPermission="true" DefaultValue="7" WebCategory="Microsoft Dynamics NAV" WebDisplayName="Number of rows to show."> </Property> </Properties> </ClientWebPart> </Elements> |
Install the App on your SharePoint Site
When you have created app in Visual Studio, you can press F5, and Visual Studio will deploy the app to SharePoint and install it on the SharePoint site that you chose for the project.
Important |
---|
In this scenario, you must use a developer subscription of SharePoint Online. Visual Studio makes use of the SharePoint side-loading feature for uploading and installing the app, and this feature is only available in developer subscriptions. |
You must sign in to <site name>.sharepoint.com as the administrator for the site. For example, the URL for the team site for an Office 365 developer site is https://<site name>.sharepoint.com/_layouts/15/start.aspx#/SitePages/DevHome.aspx. The .app file that was built by Visual Studio is added to the Apps in Testing section. When you choose the app, you are directed to the Microsoft Dynamics NAV Web client, and you are signed in automatically.
Adding an App from the App Catalog
You can also choose to only publish the project in Visual Studio. Then, you must manually deploy the app file that that Visual Studio builds to SharePoint’s App Catalog. From the app catalog, the app can be added to any site that is part of your SharePoint organization.
If the SharePoint site has subsites, you can deploy the app to the subsites, or you can let users add the app manually, provided they have permission to add apps to their site. If you upload the Microsoft Dynamics NAV app to the App Catalog, it is automatically available for users to install when they browse apps under From Your Organization. When the app has been installed, users can choose the app and be directed to the Microsoft Dynamics NAV Web client where they are signed in automatically.
If you want to preconfigure your users’ sites, you can deploy the app to one or more site templates. For more information, see the Deploy a custom app section in Use the App Catalog to make custom business apps available for the SharePoint Online environment in the SharePoint Online admin center.
In both cases, you can provide the users with SharePoint sites that give them access to view and modify Microsoft Dynamics NAV data and any other information that you want them to have access to. You can choose to combine this with the document library functionality in SharePoint so that documents that are exported from Microsoft Dynamics NAV are stored on the SharePoint site. For more information, see Integrating with Office 365 and SharePoint Online.
See Also
Tasks
How to: Configure SSL to Secure the Connection to Microsoft Dynamics NAV Web ClientTroubleshooting: Microsoft Dynamics NAV and SharePoint
Concepts
Authenticate Users with Windows Azure Active DirectoryMicrosoft Dynamics NAV as an App for SharePoint
Embedding Microsoft Dynamics NAV Web Client Pages in Other Websites
Other Resources
Select an Office 365 plan for businessHow to: Create a basic provider-hosted app
Use the App Catalog to make custom business apps available for your SharePoint Online environment