4

We're currently developing an SharePoint Online app that is hosted in Azure. We can navigate to the app via the Site Contents of the page and loads correctly. What we would ideally like is to be able to navigate a particular page in our app (it contains around 10 pages displaying different information) from SharePoint.

We have added a custom link on the menu in SharePoint using the AppRedirect.aspx, including other query string like the client_id and SPHostUrl, however, the issue lies when trying to access the separate pages. We receive an "object reference not set to an instance of an object" error, which is relating to the app not finding the ClientContext in our app. It is like the app is not authenticating correctly. The strange thing is that when we go to the default home page of the app, it authenticates, then allows us to navigate to the separate pages from the menu.

Is there some level of authentication we are missing to allow users to navigate to a certain page on our app without them having to first go to the default app home page to authenticate? We've been trying to resolve this for a while, but to no avail.

Thanks

1

The above mentioned scenario is working as per design w.r.to SharePoint hosted apps. The first activity in hosted app is authentication which happens in the page load event by calling the context token methods in default page this way oath token will be generated to gain access to SharePoint resources.if you are accessing this outside of SharePoint then you will get the same error as "object reference not set to an instance of an object" because it cant able to get the required access tokens.

so the best solution for your scenario is use the page load event of your specific page to get access token and then work on the UI part so you dont need to navigate back to default page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.