Our understanding is that:

  • SPO Hosted Apps only support client side code (no server side code)
  • All webparts produced by SPO Hosted o365 apps always install as iframes under the app host domain
  • It is NOT possible to manipulate Host Parent page DOM Elements from SPO Hosted App Web Parts.
  • If our Web Part needs to manipulate Host Page DOM we must develop it as a Sandbox solution.

Given all this, is it possible to somehow deliver and install our Sandbox solution Web Part via an SPO Hosted App users can download and install from the Tenant App Catalog or o365 SPO App Store?

1 Answer 1


There are three ways to add a Web Part (or something similar) to a SharePoint Online site.

  1. Use a Sandbox Solution. You create the Sandbox Solution with the Web Part and upload it the the Solution Gallery of the Site Collection in SharePoint Online the same way you would on-premises. Note that Sandbox Solutions that contain managed code are deprecated and will no longer be supported at some point in the future.

  2. Use an App Part (also known as a Client Web Part). This is basically what you described above. It is added using an App and is added to the pages in the site using as iFrame and so on.

  3. Use an App Script Part. You use an App to add a Content Editor or Script Editor Web Part and some JavaScript into the SharePoint Online site. Because the Web Part lives in the Site and not in the App, it is added into the page in the same way any other Web Part is (that is, there is no iFrame) so you can freely manipulate the DOM. The major thing to note is that the Web Part must be fully implemented using JavaScript, you cannot use managed code.

For more information on the App Script Part see "App Script Parts in SharePoint - Office 365 Developer Patterns and Practices" and "Introducing app script part pattern for Office365 app model"

  • 1
    Forget options 1 and 2, the App Script part is the best solution here. +1 Jan 22, 2015 at 12:51
  • Is #3 limited to CEWP and Script Editor Web Parts? Is it possible to create custom Web Parts with custom properties using JavaScript alone? Back when I tested NAPA about a year ago it could not be done with NAPA. If not, might it be possible to install existing (pre-developed) Custom Web Parts using SharePoint Hosted (all javascript) solution? What we are trying to do is use an SPO Hosted app to allow user installation of a custom Web Part with Custom Properties that must run on the host site and manipulate Host page DOM.
    – Hell.Bent
    Jan 23, 2015 at 12:10
  • You cannot use an App to deploy a managed code assembly to the SharePoint Server so: 1) no, you cannot deploy custom Web Parts to the server from an App, and 2) yes, all code pushed to the server must be JavaScript Jan 23, 2015 at 13:48
  • I have not tried this yet but it appears that you can simulate custom web part properties using JavaScript. See "Build Custom Web Part Properties with JSOM" (vxcompany.com/kennis/blog/2014/10/02/…) Jan 23, 2015 at 13:51
  • Very interesting approach... we are testing the steps in that kennis blog now on NAPA.
    – Hell.Bent
    Jan 24, 2015 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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