I created a provider hosted app part and installed it succesfully to a sitecollection. I created a subsite. In this subsite I would like to add the app part to a page. But I do not see the app part. It looks like it is not available on subsites. How can I fix this?
2 Answers
It is not needed to install the app to the app catalog. There is also another solution where you dont need the app catalog. The solution is to use CSOM Web.LoadAndInstallApp method. For each new subsite you need to execute this method which will install the app on subsite level. You need also to activate the sideloading and developer feature on site collection level.
// activate required sitecollection features (developer feature and sideloading feature)
....
string appFullPath = String.Format(@"{0}Apps\ProvGLD.Bestuursmonitor.SharePoint.Provisioning.app", AppDomain.CurrentDomain.BaseDirectory);
using (var packageStream = System.IO.File.OpenRead(appFullPath))
{
AppInstance appInstance = context.Web.LoadAndInstallApp(packageStream);
context.Load(appInstance);
context.ExecuteQuery();
}
// deactivate required sitecollection features (developer feature and sideloading feature)
....
I hope you have added your Provider Hosted App in App Catalog. Also you have added an app Client WebPart into your Provider Hosted App.
For more information about adding Client WebPart you can click here
If yes then follow this steps, because first you have to add your app to the sub site too:
- Go to site contents in your sub site
- Click Add an App
- Add your app to the sub site
- Once you are done then this will be available in your App Part
Similar question just for your reference.
Let me know if you need more clarification.
-
I do not used the App Catalog. And actually I do not want to manual add the app to each new created subsite. Is there no other solution where the app is already installed in each new subsite?– OlaDec 13, 2016 at 11:29
-
-