jeudi 26 février 2015

Debugging remote event receiver - no context token



I am trying to use the MS supplied BasicDataOperations provider hosted app to play around with and learn about remote event receivers.


I was following the instructions from this blog post by Chris O'Brien to deploy the app to a SharePoint Online site, and deploy the remote event receiver web to an Azure website. I've also set up an Azure Service Bus to do the redirection to my computer so I can debug the code.


When I try to debug, everything starts up normally, the app gets deployed to the SharePoint site, and when I add a list item through the app, my breakpoint gets hit. However, I am also getting a GetContextTokenError. The error message is:



The endpoint address 'http://ift.tt/1AxjvmC' does not match the app's endpoint 'my-azure-site.azurewebsites.net'.



I'm not sure where to go to specify/change the app's endpoint. Is that happening because I registered the app on AppRegNew.aspx using the Azure site URL?


My app manifest looks like this:



<Properties>
<Title>BasicDataOperations</Title>
<StartPage>http://ift.tt/1AOW5bt;
<!--<StartPage>~appWebUrl/Lists/List1</StartPage>-->
<InstalledEventEndpoint>~remoteAppUrl/AppEventReceiver.svc</InstalledEventEndpoint>
</Properties>


and as far as I'm aware, using the ~remoteAppUrl token in the event endpoint is what's somehow connecting the events through the service bus back to my computer. That's also what I'm using in the event receiver declaration:



<Receivers ListTemplateId="100">
<Receiver>
<Name>RemoteEventReceiver1ItemAdding</Name>
<Type>ItemAdding</Type>
<SequenceNumber>10000</SequenceNumber>
<Url>~remoteAppUrl/RemoteEventReceiver1.svc</Url>
</Receiver>
</Receivers>


And I'm not even worried about the AppEventReceiever.svc right now, I just want to get everything working with the RemoteEventReceiver1.svc. Without the token, the BasicDataOperations code doesn't run (they check for a valid context token before doing anything), and even if I wrote some code that would run, I'm sure I probably need that context token for something, right?


So how do I set it up so that I get a valid context token while debugging?








0 commentaires:

Enregistrer un commentaire