Installing SPFX App in Tenant site


  • I am trying to install a SPFX(.sppkg) app while the site is generated. The site is created using Provider Hosted. The App was developed using CSOM and the site is developer Tenant site.

    I am trying to add the app to the site using the following code

    string path = @"~/App_Data/xxx.sppkg";

      // Create context for SharePoint online
            ClientContext ctx = new ClientContext(url);
            ctx.AuthenticationMode = ClientAuthenticationMode.Default;
            ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword);
            // Get variables for the operations
            Site site = ctx.Site;
            Web web = ctx.Web;
                // Make sure we have side loading enabled. 
                // Using PnP Nuget package extensions.
                    string appFilePath = System.Web.Hosting.HostingEnvironment.MapPath(path);
                    // Load .app file and install that to site
                    var appstream = System.IO.File.OpenRead(appFilePath);
                    AppInstance app = web.LoadAndInstallApp(appstream);                    
                 catch(Exception ex)
                // Disable side loading feature using 
                // PnP Nuget package extensions. 

    but when i tried the code above, I get the following error

    "Value cannot be null.
    Parameter name: xeAppPermissionRequests."

    This issue occurs only when adding the app using Code.

    Also we tried to add the app using the app stapling method, I get the following error.

    "Sorry, something went wrong
    An unexpected error has occurred."

    While adding the app manually(using add an app) We were able to install the app without any issue.

    But we have to do this in a programmatic way.

    Is there any way to overcome this issue ? Please suggest.

    Thanks in Advance

    Wednesday, March 15, 2017 2:04 PM

All replies

  • Hi Everybody,

    I am still stuck with this issue. Please help with a solution ASAP. I have a very tight deadline to complete this task.

    Much Appreciated.

    Friday, March 17, 2017 11:12 AM
  • Hi,

    Please try to set First release for everyone in admin center.

    Or try to upload the xxx.sppkg file into the app catalog, and then deploy it and check if it works.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Monday, March 20, 2017 7:58 AM
  • Can someone please help? I tried to deploy <g class="gr_ gr_24 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar multiReplace" data-gr-id="24" id="24">a out-of-box</g>SPFx solution to 2016 <g class="gr_ gr_49 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="49" id="49">on </g><g class="gr_ gr_78 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Punctuation only-del replaceWithoutSep" data-gr-id="78" id="78"><g class="gr_ gr_49 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del multiReplace" data-gr-id="49" id="49">premise</g>,</g> and got the same error message.

    Value cannot be null.
    Parameter name: xeAppPermissionRequests

    I am just deploying to a developer site. So no App catalog involved. Since most developer will only have this available, so we do need to get this to work.

    John Architect

    Friday, October 6, 2017 7:14 PM