I have a project documents library in one site collection (projects) and I need to fetch and display these files in another site collection (HR) in SharePoint online , but the users from HR do not have permissions on project documents and also we do not want to mirror the document library in HR site collection.
I tried to fetch the documents using REST API :
GET method -
var requestUri = _spPageContextInfo.webAbsoluteUrl +"/_api/web/lists/getByTitle('Test Project Documents')/items?$select=EncodedAbsUrl,*,File/Name&$expand=File";
var requestHeaders = "accept": "application/json;odata=verbose"
But I got the response code of 404 as Project Documents Library was not present in HR site collection.
Reference: https://www.enjoysharepoint.com/get-documents-from-document-library-sharepoint-rest-api/
Also i tried looking into cross domain but it is not supported in SharePoint Online.
Any leads will be so helpful.
Regards,
Sachin