0

I'm trying to access multiple client contexts (not at the same time) of different lists. Each list is hosted on a separate site collection than the rest, and I need the context in order to access its host web, the list itself, and subsequently the list items. Basically, the add-in will pull in list data from different sites and aggregate into a single view.

Technically, I'm able to get a context by using the web URL of a particular list. But the user isn't being authenticated outside of this add-in and that's where the problems start. I'm getting access errors due to this.

Is there some kind of access token or a way to transfer the current user's credentials while I'm generating the contexts?

Edit: Also this add-in has permissions to read the whole site collection. It's installed at the root site collection and the lists are all in the subsite collections of the root. I'm confused why that alone isn't giving me read access to those lists?

0

A Remote Event Receiver may give you the correct token for the Client Context if you enable it on AppInstalling. It's difficult to access external Lists (from the App web), but if you throw in a WCF service and CSOM, it gives you a little more control

This post may help you when defining different Client Context based on the situation.

This post will give you the steps to create the RER

  • Thank you for the reply. I read the first article, and started searching on from there, but on a Microsoft site, it says that RERs aren't supported in SharePoint-hosted add-ins. I wouldn't be able to use any C# code to do it. – LaLaLottie Jul 21 '16 at 15:14

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.