Export (0) Print
Expand All

How to: Update host web components in SharePoint 2013

apps for SharePoint

Learn how to update app parts and custom actions in the host web of an app for SharePoint.

Last modified: June 06, 2013

Applies to: SharePoint

Be familiar with How to: Update apps for SharePoint and the prerequisites and core concepts listed in it.

Your app can install two kinds of components on a host web with descriptive markup in the app for SharePoint: custom actions and app parts. Updating these components is easier in the host web than in the app web. You don't need any update semantics. Just add/change the custom actions and app parts. When the app for SharePoint is updated, SharePoint always applies any new element manifest files and reapplies any changed element manifest files with the most recent version. No harm is done in reapplying; for example, a ribbon button for a custom action will not be added multiple times to the ribbon.

When you update an app part, SharePoint replaces the old version with the new version in the Web Part gallery. Be sure to change the Name property of the ClientWebPart object when you update an app part. Doing this ensures that, when the app is updated, SharePoint will remove the old version of the app part (which is no longer part of the app) from all pages to which it was added. Users will need to re-add the new version to pages.

If you leave the Name property unchanged, the old version remains on pages where it was added, which makes it unlikely that users will be aware that a new version of the app part is available. Also, when the app part is added to other pages, it is the new version that is added, so the same version of an app for SharePoint would have different app parts on different pages.

You can deploy other kinds of host web components programmatically using a remote event receiver that you register in the app manifest with an InstalledEventEndpoint element. You should use an UpgradedEventEndpoint receiver to update components that were originally deployed with an InstalledEventEndpoint receiver. UpgradedEventEndpoint receivers are described in How to: Create a handler for the update event in app for SharePoint 2013.

© 2015 Microsoft