question

Sachin-9234 avatar image
0 Votes"
Sachin-9234 asked MichaelHan-MSFT edited

How to fetch files from a document library in one site collection to display in a web part in another site collection in SPO without Read permissions

I have a test 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 test project documents and also we do not want to mirror the document library in HR site collection.

I was able to fetch the documents using API call :

var requestUri ="https://xxx.sharepoint.com/sites/<projects site>/_api/web/lists/getByTitle('Test Project Documents')/items?$select=EncodedAbsUrl,*,File/Name&$expand=File";

However regarding the read permissions for the library, I have an issue with it.

The test project documents contains information from different banks and we do not want to give permissions to everyone as they would have access to different bank documents as well.

The requirement was to display information in a web part in different pages for different banks without giving permissions to the project documents.

Please suggest how to proceed further regarding this.

Regards,
Sachin

office-sharepoint-onlinesharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MichaelHan-MSFT commented

Hi @Sachin-9234

Per my knowlegde, users need to have permissions to call the rest api to see the file.

As a workaround, I would suggest you create a list to store the documents information, you could use rest api call to add the file information(name and url) to this list. Then display that list in pages.



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


@Sachin-9234

Is there anything update on your issue? I am willing to hear from you.

0 Votes 0 ·