I'm trying to install an app on a site collection via CSOM code.
First I'm getting the list from the appcatalog on the app catalog site collection. Then I'm getting the app-file as a listitem and I'm making a stream of it. But when I try to call LoadAndInstallApp(stream)
, I get the error:
Sideloading of apps is not enabled
So I tried to turn on the enable app sideload feature:
SiteContext.Site.Features.Add(guid, true, FeatureDefinitionScope.Site);
But then I get the error
feature with id ... is not installed in this farm
Although the sideloading feature is a site-scoped feature, I tried the other scopes, but that doesn't seem to do the trick. I work on a single-server configuration.
Does anyone knows what to do to get this working?