Home >Web Front-end >JS Tutorial >Power Pages: custom Content Snippets with a HACK part 1
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:
make.powerpages.microsoft.com
.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:
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:
make.powerapps.com
-> Solutions -> Default Solution -> Search for "Content Snippet"https://your-env.api.crm4.dynamics.com/api/data/v9.2/mspp_contentsnippets
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:
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):
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!