Hi @SB ,
Once I gave the permissions for the app and save, It asked me whether I could trust this app. But the Trust button was disabled with a message ' Your tenant admin needs to approve the app'.
To help you better, is the error you described as shown in the screenshot below?
If yes, please use https://xxxx-admin.sharepoint.com/_layouts/15/appinv.aspx
to grant permissions to the newly created principal.
According to my research and testing, you can use the following Rest API to upload file to SharePoint (Per my test, we need to grant the APP Write
, Manage
, or FullControl
permissions when we upload file to SharePoint):
_api/Web/GetFolderByServerRelativeUrl('/sites/abc/FolderTest/Test')/Files/add(url='rename.xlsx',overwrite=true)')
More information for reference:
Upload a file by using the REST API and jQuery
Granting access using SharePoint App-Only
Hope it can help you. Thanks for your understanding.
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.