locked
Developing Provided-Hosted Add-in in SharePoint Online RRS feed

  • Question

  • Hi,

    I'm testing developing provided add-in in SharePoint Online. I setup the service bus for remote debugging and I wanted to test the AppInstalled event :

    - My web service is hosted on azure : https://xxxx-providerhostedapp.azurewebsites.net/Services/AppEventReceiver.svc

    It works fine

    - In my manifest.xml, I have these parameters 

    <StartPage>https://xxxx-providerhostedapp.azurewebsites.net/Pages/Default.aspx?{StandardTokens}</StartPage>
        <InstalledEventEndpoint>~remoteAppUrl/Services/AppEventReceiver.svc</InstalledEventEndpoint>


    When I do a F5 and make a breakpoint to my install event, my clientcontext is null. So nothing was executed in my function but the debugging fires.

    private void HandleAppInstalled(SPRemoteEventProperties properties)
            {
                using (ClientContext clientContext =
                    TokenHelper.CreateAppEventClientContext(properties, false))
                
                {
                    if (clientContext != null)
                    {
                        new RemoteEventReceiverManager().AssociateRemoteEventsToHostWeb(clientContext);
                    }
                }
            }

    - After that, I changed the xml in my manfest file :

    <Properties>
        <Title>Contoso.EventReceivers</Title>
        <StartPage>https://xxxx-providerhostedapp.azurewebsites.net/Pages/Default.aspx?{StandardTokens}</StartPage>
        <InstalledEventEndpoint>https://xxxx-providerhostedapp.azurewebsites.net/Services/AppEventReceiver.svc</InstalledEventEndpoint>
        <UninstallingEventEndpoint>https://xxxx-providerhostedapp.azurewebsites.net/Services/AppEventReceiver.svc</UninstallingEventEndpoint>
      </Properties>

    With this configuration, everything works fine. My context is loaded perfectly but I can't debug my program with F5.

    The only way to debug my event is to load manuall my app file in the SharePoint catalog and attach debugger azure web site.

    I want to understand the difference between deploying app with F5 and manually. Should I use token ~remoteAppUrl or use explicit url ?

    The localhost adresses are not reachable when I'm debugging. In this cas, the instances in IIS Express are not useful.

    Do you have any ideas ?

    Cordially.

    Friday, October 21, 2016 10:11 AM

Answers