SharePoint Document Issues

How to Retrieve SharePoint Documents in a Dynamics 365 PCF Control

Phi Hung VoPhi Hung Vo Oct 28, 2026 869 views

Question details

The developer needs a programmatic way to list SharePoint documents associated with an entity record using a Power Apps Component Framework (PCF) control in Dynamics 365.

How to Retrieve SharePoint Documents in a Dynamics 365 PCF Control
Product
Microsoft Dynamics 365 / SharePoint
Device & OS
not provided
Scenario
Creating a custom PCF control designed to work dynamically across multiple entities that support SharePoint document management.
Observed behavior
The developer is seeking the correct API endpoints and methodology to fetch metadata for SharePoint documents linked to a Dynamics 365 entity record.
Before you start

Ensure you have the necessary system administrator or developer permissions in your Dynamics 365 environment and have familiarized yourself with the Dataverse Web API and Microsoft Graph endpoints.

Solution 1Recommended

Use Dataverse Web API and Microsoft Graph to Fetch Documents

The standard developer approach involves querying the Dataverse document-location relationships to identify the target folder, followed by retrieving document metadata via APIs.

This implementation requires integrating Dynamics 365 and Dataverse document management rather than using a standard SharePoint configuration.

Because PCF controls operate within the Dynamics CRM context, you need to programmatically navigate the relationship between the Dynamics entity and its designated SharePoint document location.

1
Query Document Locations

Use the Dataverse Web API to query the sharepointdocumentlocations table. Filter the records using the ID of the current entity record context provided to your PCF control.

2
Identify the Site and Library

Extract the relative URL and the associated SharePoint Site ID from the query results to pinpoint the exact SharePoint library and folder mapping to your entity record.

3
Fetch Document Metadata

Make authenticated calls to the Microsoft Graph API or the SharePoint REST endpoints using the identified site and folder paths to retrieve the actual document metadata, such as file names, URLs, and modified dates.

Use Dataverse Web API and Microsoft Graph to Fetch Documents
Developer Resources: Since this is a specialized development scenario, it is highly recommended to seek PCF-specific implementation guidance and authentication requirements directly from the Microsoft Dynamics 365 Community forums.
Free Microsoft Office alternative

Looking for a Lightweight Document Editor? Try WPS Office

While developing enterprise solutions in Dynamics 365 and SharePoint, you often need a reliable office suite to test, view, and format exported documents. WPS Office provides a free, highly compatible alternative to Microsoft Office, featuring a familiar interface and seamless support for Word, Excel, and PowerPoint files.

  1. 1. Download and Install: Visit the WPS official website to download the free installer for your operating system.
  2. 2. Open Your Documents: Launch WPS Office and open documents retrieved or generated from your Dynamics 365 environment.
  3. 3. Edit and Save: Edit the contents using familiar formatting tools and save them back to native Microsoft formats seamlessly.
Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx)Lightweight and fast to install, reducing system resource consumptionFamiliar tabbed user interface ensuring a zero learning curvePerfect for viewing and editing documents exported from Dynamics 365 or SharePoint
microsoft office alternative - wps office

Frequently Asked Questions

Can I use standard SharePoint list views directly in a Dynamics 365 PCF control?

No, a PCF control typically renders its own user interface. You must retrieve the data programmatically via APIs (like Dataverse and Microsoft Graph) and bind it to your custom control's interface.

Where can I find support for PCF control API authentication errors?

The most effective place to ask PCF-specific questions and troubleshoot API permission errors is the official Microsoft Dynamics 365 Community forums, where dedicated CRM developers share implementations.

Does the Dataverse Web API return the actual SharePoint file content?

No, the Dataverse API primarily returns the document location metadata, such as the folder path. You must use the Microsoft Graph API or SharePoint REST API to interact with or download the actual file content.

Are there authentication differences when querying SharePoint from a PCF control?

Yes. Since PCF controls run within the browser context of Dynamics 365, you may need to handle cross-origin resource sharing (CORS) or leverage Azure Active Directory (AAD) tokens to seamlessly authenticate against Microsoft Graph or SharePoint APIs.