0

We have (02) SharePoint farm in different domain and they are connected.

We need to access data from Farm-A SharePoint List in Farm-B using Rest-API

usually we calling REST API by just URL as below when in same domain. But when domain is different what can we do?

https://mysharepoint.com/_api/web/lists/getbyTitle('Events')/items 
?$top=1 
&$select=Title,Description,Date 
&$filter=ID eq 12
0

For cross domain call, You can use SP.AppContextSite

Example:

appContextSite = new SP.AppContextSite(ctx, spHostUrl);

Nweb = appContextSite.get_web();
ctx.load(Nweb); 

REST:

Now your rest url will be like below,

var url = appwebUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbyTitle('Events')/items?$top=1&$select=Title,Description,Date&$filter=ID eq 12&@target='" + hostwebUrl + "'";

For refer in details, you follow this link and this link

If you find this answer as useful, upvote it.

  • How should I pass the credentials? – Taha Zubair Nov 16 '17 at 7:03
  • Not required, same user must have access of another domain's site. – Anil Pal Nov 16 '17 at 7:47
  • how domain1\user1 added in another domain? I mean how SharePoint find user1 in domain2? – Taha Zubair Nov 16 '17 at 8:17
  • User 1 is common for site, right? only domians are different? – Anil Pal Nov 16 '17 at 9:27
  • But domain is not same doamin1\user1 and doamin2\user1. – Taha Zubair Nov 18 '17 at 20:36

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.