mercredi 4 mars 2015

How can I navigate through Pages in my App using the OAuth authorization process?



I'm working on a provider-hosted App which has several Sites like



  • Index

  • Manage

  • Users


The Users will need to navigate through specific sites in my App. I have a link on the Index Page which goes to the Manage Page which looks like that:



<a href="~/MyApp/Manage">Click here to manage the App!</a>


If I make a link like that, the User will just go directly to my Page without using the SharePoint redirection logic, which is not what I want. That is because the Manage Page needs to perform some calls using the CSOM (Client Side Object Model) which requires the OAuth authorization process with the SharePoint Server.


I noticed that the SharePoint's Chrome Control uses the SPAppWeb Parameter of the URL-QueryString to call the app via the SharePoint again:



URL: https://localhost:44300/MyApp/Index?...SPAppWebURL=https%3A%2F%2Fmydomain-55695aefde0b52%2Esharepoint%2Ecom%2Fsites%2Fdev%2FMyApp


When calling the http://ift.tt/1w2s1dj the authorization progress from the SharePoint Server starts again and my App gets called with the necessary OAuth Tokens.


But that only works for the Index page! In fact it calls the specified <StartPage> in the AppManifest.xml file.



  • What would I need to do to make it redirect to another Page of my App?

  • Can I declare Routes to use the AppWebURL to redirect to a specific site in my App?








0 commentaires:

Enregistrer un commentaire