Apps (e.g. Yammer app) as part of site template

Scenario - in Office 365, you want to develop a custom site template (i.e. a WebTemplate) which includes an app from the Store (which has already been obtained by a O365 Global Administrator).

For the end-user, any site created from this template should automatically include this app, with the app part pre-added to the home page. In my scenario, it's actually the *Yammer* app we are trying to accomplish this with. (We appreciate this particular app part then requires further configuration [e.g. selection of a Yammer feed]).

Approaches I've ruled out:

  • Tenant-scoped app install. This cannot be used with an app which contains an app part, as per "Limitations of tenant-scoped apps" at http://msdn.microsoft.com/en-us/library/fp179896.aspx
  • Using PowerShell to "batch install" the app. This is Office 365 :)  
  • Using CSOM to install the app as part of the site provisioning process (e.g. in the WebProvisioned event). The CSOM methods to do this (e.g. Microsoft.SharePoint.Client.Web.LoadAndInstallApp()) rely on having access to the .app file for the app. For a store app, the consumer does not have access to this file (as far as I can tell) - so I conclude these methods are intended for custom apps only, not store apps
We have some bits working e.g. auto-adding the app part to the home page *if* the app is installed to the site. Any ideas on how to accomplish this? I'm hoping the answer is not "sorry, the intention is that apps with an app part must always be installed to a site manually".

1 comment:

Charlie Normand said...

So being the cowboy that I am, I tried installing my SharePoint Hosted App with App Part (which fetches a list of my followed sites into the web part), to the app catalog. Then I deployed the app to a number of sites via the deployment option for the app in the catalog. Then I put the app part on my app catalog page, viewed source, copied the iframe and the script above it, and put it in a snipped on a site collection where I had 'deployed' it to. And it 'works'.... not sure if this is very good practice...