0

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?

3 Answers 3

1

You fell for it, Its a horrible Gotcha, courtesy of Microsoft.

Contrary to what it implies, Feature definition Scope is not about the feature scope. The correct value is either Site for sandbox solutions, or Farm for everything else. None and Web are never valid values.

So the correct use is:

SiteContext.Site.Features.Add(guid, true, FeatureDefinitionScope.Farm);
0

Please have a look this link below: http://blogs.msdn.com/b/officeapps/archive/2013/12/10/enable-app-sideloading-in-your-non-developer-site-collection.aspx

1
  • Thx.. I also found that article, but that's a way to activate the feature through powershell; isn't there a way to activate the feature through CSOM?
    – nIWco
    Jun 20, 2014 at 6:33
0

When I used another clientContext instead of a clientContext with Access Token, i could install the app from the AppCatalog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.