2

I have a SharePoint hosted app. I need to enable an edit section inside the app only when the page is in edit mode. This way I am making sure that only users with edit permission can view this option. The issue is that I am not able to determine, from within the app, whether or not the page is in the edit mode.

Currently, I am passing the following in the src of the ClientWebPart to check if the Web Part is in the edit mode,

editmode=_editMode_

Though, this implementation is working, it includes the following steps:

  1. Click the Edit Page option of the SharePoint page.
  2. In edit mode, for the target Web Part, click the Edit Web Part option.
  3. The private edit section is now visible.

My question is, can I reduce the above number of steps by completing bypassing the second option? Please advice.

0

You can make use of WSSDesignConsole placeholder from the master page

  • Can I access that from the app? As far as I know, the app code will be executed from within a frame and since, the domain of the page will be different than the domain of the app, browsers will block all the cross-domain access for security. – Piyush Jun 6 '16 at 12:06
  • Is your master page hosted under site collection level and using the master page, you can, although its web level – Shiva Jun 6 '16 at 12:42
  • In SharePoint Online I have absolutely no access on the page where the app is hosted. I can't even get the url of the page where the app is running. So any tag, which is a part of the host page and not app page is invisible to the app. – Piyush Jun 6 '16 at 12:57
0

It seems there's no direct way through which the SharePoint app can communicate directly with the host page. We have to rely on the limited queryStrings that SharePoint provides on-load. Which means that, the user has to first edit the page and then, edit the web part and only then, I can pick up the info that the given app is in the edit mode. One extra step for the user.

https://social.msdn.microsoft.com/Forums/officeapps/en-US/091559b6-eb8c-467b-bcbd-d3fef3415772/check-if-the-current-sharepoint-page-is-in-edit-mode-from-within-a-sharepoint-online-app?forum=appsforsharepoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.