Replace web parts in sandbox solutions

One of the reasons many developers have leveraged code-based sandbox solutions is a desire to utilize visual web parts. This provides a great way to separate code from layout as well as utilize the ASP.NET controls. You can continue to use visual web parts in a provider-hosted add-in via client web parts. This is a great approach and provides a direct migration path for many applications.

Another option is to rewrite the web part as a client-side solution. This involves redesigning the solution to use JavaScript, HTML fragments, and one or more supporting frameworks. While this is net-new work, it has the added benefit of setting up your solution to easily integrate into the upcoming SharePoint Framework. This is a great choice for simple display or data entry web parts, and can scale up to full-page client applications.

Note

Code-based sandbox solutions were deprecated in 2014, and SharePoint Online has started the process to completely remove this capability. Code-based sandbox solutions are also deprecated in SharePoint 2013 and in SharePoint 2016.

Options for replacing web parts

Approach Design considerations and more information
Provider-hosted add-in client web part
  • Requires hosting infrastructure.
  • Hosting infrastructure must be highly available.
  • Client part is displayed in an <iframe> limiting communication with the rest of the page.
  • Must use remote APIs either via CSOM or REST.
Client-side solution
  • The ability to embed JavaScript in the prescribed way (through a UserCustomAction) does not work currently outside of the classic experience. For these cases you can link to the files by using a Script Editor web part.
  • Cannot elevate permissions, instead use a micro-service with add-in-only permissions.
  • Limited by permissions of current user.

Removing sandbox code from your site

When you deactivate your existing sandbox solution from your sites, any assets or files deployed by using declarative options are not removed. However, the features in the sandbox solution are automatically deactivated and the event receiver is removed.

See also