Skip to content

By clicking the custom button of our project SPFx site page display in edit mode #9808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
9 tasks done
princebagthariya opened this issue Jul 18, 2024 · 2 comments
Open
9 tasks done
Assignees
Labels
Needs: Author Feedback Awaiting response from the original poster of the issue. Marked as stale if no activity for 7 days. Needs: Triage 🔍 Awaiting categorization and initial review. sharepoint-developer-support sharepoint-developer-support

Comments

@princebagthariya
Copy link

princebagthariya commented Jul 18, 2024

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx version - 1.17.1
  • Node.js version - 16.20.0

Issue description

Hello Everyone,

I have created an SPFx project with React.

I want to display the SPFx site page in edit mode by clicking the custom button, not SharePoint default edit button

Can anyone help me with the same?

@Tanddant
Copy link
Contributor

Tanddant commented Jul 25, 2024

Am I understanding you correctly in that you want to be able to press a button and go into edit mode on the page?

Firstly make sure you check out the page to the user via the rest API

If you're using PnPjs that looks something like this

sp.web.getFileByServerRelativePath("/sites/dev/SitePages/Home.aspx").checkout();

Then you can enable edit mode on the page by appending the query paramater Mode=Edit

const EditPage = () => {
    let searchParams = new URLSearchParams(window.location.search);
    searchParams.set("Mode","Edit")
    window.location.search = searchParams.toString();
}

EditPage();

@VesaJuvonen VesaJuvonen added the Needs: Triage 🔍 Awaiting categorization and initial review. label Jul 29, 2024
@Ashlesha-MSFT Ashlesha-MSFT self-assigned this Jun 10, 2025
@Ashlesha-MSFT Ashlesha-MSFT added the sharepoint-developer-support sharepoint-developer-support label Jun 10, 2025
@Ashlesha-MSFT
Copy link

Hi @princebagthariya,
Just wanted to follow up on this issue. Were you able to try the solution shared in above comment regarding using the Mode=Edit query parameter and checking out the page via the REST API or PnPjs?

Please let us know if this approach worked for your scenario or if you're still experiencing any issues.

@Ashlesha-MSFT Ashlesha-MSFT added the Needs: Author Feedback Awaiting response from the original poster of the issue. Marked as stale if no activity for 7 days. label Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Awaiting response from the original poster of the issue. Marked as stale if no activity for 7 days. Needs: Triage 🔍 Awaiting categorization and initial review. sharepoint-developer-support sharepoint-developer-support
Projects
None yet
Development

No branches or pull requests

4 participants