0

I have a scenario where a user has some data related to him in a SP on premises site (site1), but he doesn't have access to site1. The user is having access to another site2 where we want to have webpart/page to show him data related to him from site1.

We want to use SharePoint REST or CSOM from browser to query data from site1 while user is logged into site2. We will have the username and password of some user from site1 in webpart config that will be used to fetch data from site1. I see many examples where credentials are used to login to CSOM from server side C# code but not any where this is done from browser side JavaScript.

Please tell is this is possible either using REST or CSOM from Javascript. Or is there another way of achieving this. Ideally we want this to be reusable from SPOnline scenario as well.

Thanks.

Prakash
  • 109
  • 4
  • 1
    How do you imagine doing this without exposing the intermediary credentials? You will need a back-end service of some sort. – Etheryte Jan 02 '15 at 13:04
  • I wouldn't recommend doing this via browser JavaScript because you would have to put the credentials in your JavaScript code which would make it visible to the user. You need to run CSOM C# code on your server(site2) to fetch the data (from site1) for you. – Chirag Bhatia - chirag64 Jan 06 '15 at 18:41
  • We used CSOM C# as Chirag64 suggested, though we wanted to avoid it. This solution can't be used in SPOnline without running deprecated sandbox code on the site. Thanks for your suggestions. – Prakash Jul 02 '15 at 13:45

0 Answers0