Hi @Лижичка Мар'ян Ярославович,
According to your description, do you want to get files in SharePoint using Rest API? If my understanding is wrong, please feel free to contact me.
Based on my research and testing, you can use the following Rest API to get files in SharePoint:
GET https://{site_url}/_api/web/lists/GetByTitle('Test')/items
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
If you want to get a specific file, you can use the following REST API:
GET https://{site_url}/_api/web/lists/GetByTitle('Test')/items({item_id})
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
For example:
In addition, when you generate the access_token
, are permissions granted to the add-in, and what permissions are granted? Please try granting Full Control
permissions, for example: enter the below XML in the “Permission Request XML” box:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
</AppPermissionRequests>
More information for reference:
- Rest API: Working with lists and list items with REST
- Generate access-token and access SharePoint: In 4 steps access SharePoint online data using postman tool
Hope it can help you. Thanks for your understanding.
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.