Embedding SharePoint documents

Loading

Embedding SharePoint documents within Power Pages allows organizations to display, manage, and interact with files stored in SharePoint directly through a public or private portal. This is especially useful for scenarios like document sharing, policy publishing, collaboration portals, and customer-facing resource centers—all while leveraging SharePoint’s robust document management capabilities.

In this guide, you’ll learn the various methods of embedding SharePoint documents in Power Pages, security considerations, technical requirements, and practical examples.


Why Embed SharePoint Documents in Power Pages?

Although Power Pages uses Dataverse as the native storage, SharePoint is often used in parallel for managing large or structured documents. Integration benefits include:

  • Centralized document management using SharePoint libraries
  • Real-time access to the latest document versions
  • Avoiding file size and storage limits in Dataverse
  • Leveraging SharePoint security and versioning features
  • Embedding files such as PDFs, Word, Excel, or PPTs

Methods to Embed SharePoint Documents

There are two main approaches to embedding SharePoint documents into Power Pages:

1. Embed via iFrame Using SharePoint Embed Links

This method allows users to directly view a SharePoint document on a web page using the document’s embed code.

Steps:

  1. Go to your SharePoint document library.
  2. Open the file you want to embed (e.g., a PDF or Word document).
  3. Click the “…” > Embed” or “File > Share > Embed”.
  4. Copy the embed HTML <iframe> code.
  5. In Power Pages:
    • Open the page in Design Studio
    • Add an HTML/Text component
    • Paste the embed code inside it

Example Embed Code:

<iframe src="https://contoso.sharepoint.com/sites/Docs/Shared%20Documents/sample.pdf" width="800" height="600" frameborder="0"></iframe>

This approach works best for public/internal documents with anonymous access or authenticated user permissions.


2. Display Files Linked from Dataverse Records (Advanced)

In more secure or dynamic scenarios, you may want to:

  • Link SharePoint files to Dataverse records
  • Display those links dynamically in Power Pages
  • Use Dataverse-SharePoint integration

Steps:

  1. Enable SharePoint Integration in Dataverse
    • Go to Power Apps > Settings > Document Management
    • Enable SharePoint integration
    • Select site URL where documents will be stored
    • Enable for specific tables (e.g., Account, Case)
  2. Upload Documents via Dynamics/Dataverse
    • Navigate to a record in Dynamics 365 or Power Apps
    • Use Documents tab to upload to the connected SharePoint folder
  3. Display SharePoint Document Links in Power Pages
    • Add a Web File or Entity List to show URLs or file names
    • Customize with Liquid or JavaScript for improved styling
    • You can also embed SharePoint document viewers with dynamic URLs

Ensure that permissions are properly configured on both SharePoint and Power Pages.


Authentication and Access

Accessing SharePoint documents from Power Pages requires careful planning, as Power Pages users are typically external to your organization.

Options:

ScenarioAuthentication RequiredNotes
Public documentsNoneSuitable for anonymous users
Internal accessAzure AD / SharePoint permissionsUsers must be internal or B2B guests
External usersAzure AD B2C + Graph APIComplex, needs token-based access or proxy pattern

If your documents are sensitive, do not rely on public links. Use SharePoint’s permission model with token-based API integration or Azure AD B2B where appropriate.


Best Practices for Embedding SharePoint Documents

  • Use iFrame embedding only for public or semi-public documents
  • For secure documents, consider using Power Automate or custom APIs to retrieve and serve document links securely
  • Regularly audit SharePoint permissions and sharing settings
  • Use responsive design to make embedded files mobile-friendly
  • Store metadata about documents in Dataverse to allow filtering/sorting

Sample Use Cases

1. Knowledge Base Portal

  • Display downloadable PDFs of manuals or guides stored in SharePoint

2. Policy Portal

  • Embed Word or PDF documents of company policies for employees or clients

3. Customer Resource Center

  • Link support documents to case records dynamically via Dataverse

4. Vendor/Partner Portal

  • Allow partners to view or download project files, invoices, and contracts

Security Considerations

  • Always validate the visibility of SharePoint documents before embedding
  • For portals accessible to external users, avoid exposing internal SharePoint URLs
  • Use Azure AD B2B or token-based access for secure document embedding
  • Consider proxying document access through Azure Functions or custom APIs

Limitations

  • Direct embedding is only ideal for public documents
  • SharePoint embed URLs may not work in all browsers or for all users
  • There’s no native document viewer component in Power Pages—you’ll need to use iframe or third-party viewers

Leave a Reply

Your email address will not be published. Required fields are marked *