Microsoft Graph API file permissions are not visible/delete - sharepoint

I am trying to create Read permissions for a single file in the sharepoint online site document library without any issues.
I am capturing the permissionID while creating the permission on the specific file. immediately I am trying to delete the same permission and I am getting the below exception:
HTTP Response Code:404; Response Message: The resource could not be found
Below URL I am using to delete a permission:
https://graph.microsoft.com/v1.0/drives/{driveId}/root:/{pathToFile}:/permissions/{permissionID}.
any help can be appreciated.

Related

Copy Sharepoint online csv to datalake using Azure Data Factory

I am trying to copy CSV file from Sharepoint online to Data lake using Data Factory. I followed the below documentation.
https://learn.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list?tabs=data-factory#copy-file-from-sharepoint-online
My pipeline looks below
I am getting errors in the copy data activity. My connection to Sharepoint is successful, and even I can download the CSV file using the base & relative URL.
Below is my error
Error code 2200
ErrorCode=HttpRequestFailedWithClientError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with client error, status code 403 Forbidden, please check your activity settings. If you configured a baseUrl that includes path, please make sure it ends with '/'.
Request URL: https://xxxx.sharepoint.com/sites/39421875/_api/web/GetFileByServerRelativeUrl('/sites/39421875/Shared%20Documents/Test.csv')/$value.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=System,'
My base URL: https://xxx.sharepoint.com/
Relative URL: sites/39421875/_api/web/GetFileByServerRelativeUrl('/sites/39421875/Shared Documents/Test.csv')/$value
Not sure why the above error is coming? I added "/" in the base URL.
I tried multiple times, and the same error is happening. Even I tried to give a complete URL in the base URL but with no success. I followed the documentation for the Additional Header.
Can anyone advise?
The above error is mainly because of Authorization Failure. Please make sure to check whether the below permissions are granted or not.
Go to Azure Active directory -> App registration and open app -> API permission -> Add this permissions.
And also please follow the below reference: It has detailed information about app permission on specific site collection and Authorization of SharePoint.
Reference:
DataFactory: Extract data from SharePoint Online by javiBI
Access SharePoint Online using Postman by Shantha Kumar

Getting error while copying the file from sharepoint to blob storage in ADF

I am getting this error ,
"ErrorCode=UserErrorFailedFileOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Upload file failed at path sapoutput.,Source=mscorlib,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=System,"
While copying a file from sharepoint site to blob storage
My web activity to get access token is running fine but there is error in copy activity.
If you don’t have required permission and you will get this error.
For granting SharePoint access permission you need to register application
Open SharePoint online site -> Search application id and fill the empty fields –> add domain name and register URL
Please follow this Microsoft document for more information.

Blueprism Code Producing 403 Forbidden Error

I am trying to use Blueprism to download pdf files from Sharepoint.
I am using the below code. Url and Path are both variables which get passed through. This is producing a 403 forbidden error. I believe that Blueprism is required to pass credentials to Sharepoint before it will be allowed to download the file. Is this possible?
Using wc As New System.Net.WebClient()
wc.DownloadFile(Url, Path)
End Using
I don't think you have a password related issue, likely the SharePoint is recognising your account access via AD group or SSO of some kind. 403 means the server has understood your request but is denying to fulfil it because of an access reason on the profile you have. Make sure you can manually download the file on the profile you are emulating for a start then also check the profile the bot is operating under (not necessarily yours in some cases ) has access to said file.
Literally 403 is a request that relates to an access issue so somewhere something doesn't have the correct access lined up
First of all, is this a Sharepoint Online or OnPremises version? As you understand, you are connecting to web resource via an API and as such you have to get authenticated and authorized to access those resources.
If it's SPO, you can use the API component for SharePoint integration from DX and configure.
In case of SP On prem, you have to customize a lot to achieve your results.

Microsoft Graph API returns 400 URL specified is invalid with /drive/root/children

I am trying to use MS Graph API to read files from a SharePoint form library but while the drives command works any combination to get the files fails. It should be noted I am the owner of the site with full permissions. Using the online Graph explorer tool, and granting the permissions for files.read.all and sites.read.all the command to get the default drive (documents) works:
https://graph.microsoft.com/v1.0/sites/myportal.sharepoint.com:/sites/mysite:/drive
According to the documentation link the next command should show the files in the default drive:
https://graph.microsoft.com/v1.0/sites/myportal.sharepoint.com:/sites/mysite:/drive/root/children
However the explorer throws the 400 error saying "Url specified is invalid." Same thing happens if I try to enter the folder ID.
Is there an error in the permissions or the URL or could the online explorer tool be limited?
To list SharePoint library(drive), use
https://graph.microsoft.com/v1.0/sites/siteid/drive/root/children
Test demo:

How to fix 'Access denied - error 403' in a SharePoint-based flow

I'm trying to use the Sharepoint -> Get File Content action in Power Automate, but I'm getting a 403 error - Access Denied. I am using the same login for SPO and Power Automate. I have (for now) hard-coded a file to fetch - I can definitely browse to it, but for some reason I get the error in Power Automate. Is there another permission that I need to be granted to access the same file via Power Automate that I might be missing?
I have tried Get File Content with several different files, and they all give the same result. In each case, I can manually browse to the site/library/folder where the file is and download it, using the same login.
Have you made some changes on the sharepoint permissions?
Have you recreate a new connection to sharepoint in flow connections?
In many cases, an error code of 403 appears in a flow fail because of an authentication error. If you have this type of error, you can usually fix an authentication error by updating the connection,please make sure you have update the connection.
You could refer to link below
https://learn.microsoft.com/en-us/flow/fix-flow-failures
If you have updated the connection and the issue still exists,I afraid that there is some permissions setted in the sharepoint forbid you to access the sharepoint.
Please take a try to contact with the sharepoint administrator to see if you have been access denied in sharepoint.

Resources