The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Based on my research, it appears that the SPFx Application Customizer is still suitable for your scenario. You may want to review whether the following logic has already been implemented in your setup, and whether it can apply to your case:
// pageContext.listItem.id gives you the dynamic pageId
const pageId = this.context.pageContext.listItem?.id;
// Check permissions first
const canEdit = await checkEditPermission();
if (canEdit) {
// Show button with dynamic pageId
renderButton(pageId);
}
In addition, I found that an approach using audience targeting together with an SPFx web part could also work. However, this would require manually adding the web part to each page where the button is needed.
For further insight, you may consider reaching out to the broader technical community through https://techcommunity.microsoft.com/ and https://github.com/orgs/community/discussions. These forums often include discussions from engineers and partners who have worked through similar use cases and can share practical insights.
I hope this provides some additional insight.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.