Document Libraries FAQ (Ed Smith)

A recent post, Integrating Documents in Cloud Business Apps, was published on the Apps for Office and SharePoint Blog which discusses the ability to integrate application data with SharePoint document libraries.

In this article, we will review some of the frequently asked questions and their answers. If you have other questions, please leave a comment below and we can add them to the post.

I have some Office document templates I defined for my library. Will they appear in the add/create document popup?

Yes, If there are document templates for your library, they will show up in the add/create popup automatically.

Can I get the path to the document in my server code?

Yes, you can get the items that make up the path off a document entity object. Below is a code snippet that would get the path for a products documents.

foreach (Edtest docEntity in entity.Edtests)


    UriBuilder uriBuilder = newUriBuilder(Application.SharePoint.HostUrl.Scheme, Application.SharePoint.HostUrl.Host, Application.SharePoint.HostUrl.Port, docEntity.Path + “/” + docEntity.Name);

    Uri uri = uriBuilder.Uri;

    //Do something with the uri


What happens if I connect to a document library that is not on the app’s host web?

The document library needs to reside on the same site and host web as the app to properly authenticate to the SharePoint site. If they do not reside on the same site, there will be a runtime error message like the one below when you try to access the documents tab.

An error occurred while processing this request. Inner exception message:{“error”:”invalid_client”,”error_description”:”Invalid audience Uri ‘00000003-0000-03d1-ce00-000000000000/’.”}

If you publish and specify a production SharePoint site, we will automatically update the data source SharePoint site address to point at the new site. So you need to make sure you have the library defined with your necessary columns on that site as well.

On my on-premises SharePoint, my app’s upload popup only shows upload, but not the new document options?

When apps are installed in on-premises installations on SharePoint, the new document options will not appear in the upload popup. The SharePoint capability that allowed this was rolled out cloud first to SharePoint online and is not available in on-premises SharePoint yet.

How does CBA know when to open the document in Office desktop clients and not in the browser?

When creating new documents, we will always create the document in Office Online. When opening existing documents, we will open them in Office desktop if it is installed, and in Office Online if it is not installed.

Which relationship parents are supported for the document library feature?

This initial release of the document library feature supports relating Office 365 or SharePoint document libraries with (non-SharePoint) business entities such as databases, SAP, CRM, etc. For databases, it works with both intrinsic and attach scenarios. In this release we do not support having SharePoint list as the parent entity to a document library.


I hope you found this FAQ useful. If you have further questions, the LightSwitch forums are a great place to get answers.


-Ed Smith, Software Development Engineer in Test, Cloud Business Applications Team