Home >Web Front-end >JS Tutorial >Power Pages: custom Content Snippets with a HACK part 1

Power Pages: custom Content Snippets with a HACK part 1

Linda Hamilton
Linda HamiltonOriginal
2025-01-28 00:38:11363browse

Power Pages: Bypassing Built-in Components for Full Control

Power Pages aims to simplify website creation with its low-code approach and pre-built components. However, developers seeking complete control over implementation might find these limitations restrictive. This article explores building a Single Page Application (SPA) without relying on PowerApps' built-in components.

Default Power Pages Management Apps

Creating a Power Pages site provisions two model-driven apps for website management:

  1. A portal management app accessible at make.powerpages.microsoft.com.
  2. A configuration app found at make.powerapps.com -> Apps -> Power Pages Management, used for managing content snippets and web files.

Power Pages Management App at make.powerapps.com

Content snippets within this app appear as follows:

Power Pages: custom Content Snippets with a HACK part 1

These snippets are HTML fragments. A simple example:

<code class="language-html">Frame Agreements
================</code>

These snippets reside in the Dataverse table Content Snippet (mspp_contentsnippet) and are accessible via:

  1. make.powerapps.com -> Solutions -> Default Solution -> Search for "Content Snippet"

Power Pages: custom Content Snippets with a HACK part 1

  1. A browser query: https://your-env.api.crm4.dynamics.com/api/data/v9.2/mspp_contentsnippets

Power Pages: custom Content Snippets with a HACK part 1

Note: HTTP ERROR 401 requires authentication at https://your-env.api.crm4.dynamics.com with admin credentials.

Dataverse Security Roles vs. Power Pages Web Roles

Dataverse Teams and Security Roles are relevant when using the MSAL library for Dataverse authentication (as in the author's SPA series), providing complete dependency control. Power Pages Web Roles are used when building portals using Microsoft's low-code design. For SPAs with full dependency control, Web Roles are unnecessary.

The Need for a Custom Content Snippets Table

Consider a Frame Agreements page displaying both agreement metadata and downloadable documents. Two user teams might require different access:

  1. Procurement personnel: Download functionality.
  2. Others: Metadata view only.

Using the default mspp_contentsnippet table, both groups would need Read access. While separate snippets could be created (one with, one without download), this leaves the Others group vulnerable if they possess coding skills, potentially accessing all snippets and bypassing intended access controls.

Solution: A Custom Table

Creating a custom Content Snippets table for download functionality, accessible only to Procurement, addresses this security concern.

Challenges and Solutions

Saving HTML directly to a custom table results in Power Apps stripping HTML tags. Furthermore, the desired formatted HTML view (as seen in the default app):

Power Pages: custom Content Snippets with a HACK part 1

requires a custom Power Pages Management app, which will be addressed in a subsequent article.

The above is the detailed content of Power Pages: custom Content Snippets with a HACK part 1. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn