Remote event receiver install via PNP problem

Deleted
Not applicable

Hi All,

 

since last week we have a issue with Remote event receivers installed using PNP. If i debug all works fine. 

What do we do?

We install a app on tenant level and install the app in the sites where we want to use them using PNP.

 

Tried a few things already 

install higher version on tenant level. no result

reprovision using PNP no result.

 

it seems i can not add a eventreceiver if the app is not running in de the local Site/Web.

Anybody else having the same issue?

 

Hope somebody has the solution.

 

Kr,

 

Paul

3 Replies

How do you install the app in the sites? Using side-loading? Can you share your app manifest?

Hi Bert,

 

i just checked it is not in the manifest but in a provisioning classs the code looks like this:

   AuthenticationManager authenticationManager = new AuthenticationManager();
            using (ClientContext workPackageContext = authenticationManager.GetSharePointOnlineAuthenticatedContextTenant($"{Info.ProjectUrl}/{workPackage.Url}", Info.UserName, Info.UserPassWord.ToSecureString()))
            {
                Guid sideloadingFeature = new Guid("AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D");

                string path =  Path.GetFullPath("Resources/App/DocNumber.app");
                Site site = workPackageContext.Site;
                Web web = workPackageContext.Web;
                try
                {
                    // Make sure we have side loading enabled. 
                    // Using PnP Nuget package extensions.
                    site.ActivateFeature(sideloadingFeature);
                    try
                    {
                                      
                        // Load .app file and install that to site
                        var appstream = System.IO.File.OpenRead(path);
                   
                        AppInstance app = web.LoadAndInstallApp(appstream);
                        workPackageContext.Load(app);
                        workPackageContext.ExecuteQuery();
                    }
                    catch (Exception exp)
                    {
                        TraceHelper.WriteErrorToListener("AddAppToSite Adding", exp.Message);
                    }
                    // Disable side loading feature using 
                    // PnP Nuget package extensions. 
                    site.DeactivateFeature(sideloadingFeature);
                }
                catch (Exception ex)
                {

                    TraceHelper.WriteErrorToListener("AddAppToSite", ex.Message);
                }
            }
        }

But it states in the error that the app is already installed.

 

The app is installed on tenant level  just to set the permisions. that i do not have to check the trust everytime. But since it is on tenant nivo i still need to install it in order to get it to work in the site...

 

I think that is why my event receiver does not register to a list as it is pushed from tenant level and not from a site level.

 

Hope you understand what i mean.

 

Any help is welcome.

 

Kr,

 

Paul

Found out that if i do the following:
Add the solution to the tenant v 1.0.0.4 and next provision using same code but a app with v1.0.0.5 in it. It works but it feels strange that you need to update the versionumber to get it to work.

Any other thoughts?