Forum Discussion
Using the REST API (via Zapier's Sharepoint App) to DELETE a folder does not delete the folder
Background: we use Zapier pretty much exclusively to manage automations. This one has me stumped to the point I am actually reaching out to 3rd parties to find help. Zapier has a SharePoint App already registered that runs commands to SharePoint with our Oauth tokens embedded, via the SP REST API. It's just a more user-friendly interface that then processes the REST calls
So far, I can successfully process any call/request to SharePoint except anything that has to do with DELETE. When I process a POST call using the information required for DELETE, it acts like it ran successfully (No Errors), but the folder is still on the SharePoint site. Can someone see something that is missing, or something in the response that indicates what happened?
Credentials are censored and data may be formatted and/or truncated.
selected_api: MicrosoftSharePointCLIAPI@3.6.2
object_action: undefined
object_depth: 1
--------------------------------------------------------------------------------
REQUEST
--------------------------------------------------------------------------------
POST https://:censored:19:d1eaf39465:.sharepoint.com/sites/QCPostOffice/_api/web/GetFolderByServerRelativeUrl('Shared Documents/Test Folder to Delete')?Accept=application%2Fjson%3Bodata%3Dverbose&X-HTTP-Method=DELETE&If-Match=*&X-RequestDigest=0x4B5C363C3FA6F2C905BFC1789BE612894AE2B9801405F20452F564652A061ECFE1710A5337517913E97C74C33459A08B6FBF2605C2ACDCADDF1544CEAC66E6B7%2C15%20Jul%202024%2020%3A13%3A40%20-0000
user-agent: Zapier
Authorization: :censored:5230:1c759af5b8:
Accept: application/json
--------------------------------------------------------------------------------
RESPONSE
--------------------------------------------------------------------------------
200
cache-control: private, max-age=0
connection: close
content-encoding: gzip
content-security-policy: frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com *.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;
content-type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8
dataserviceversion: 3.0
date: Mon, 15 Jul 2024 20:47:49 GMT
expires: Sun, 30 Jun 2024 20:47:50 GMT
last-modified: Mon, 15 Jul 2024 20:47:50 GMT
microsoftsharepointteamservices: 16.0.0.25026
ms-cv: oTylOp9QAFD2snDxC41sIA.0
p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
request-id: 3aa53ca1-509f-5000-f6b2-70f10b8d6c20
spclientservicerequestduration: 17
sprequestduration: 18
sprequestguid: 3aa53ca1-509f-5000-f6b2-70f10b8d6c20
strict-transport-security: max-age=31536000
transfer-encoding: chunked
vary: Origin,Accept-Encoding
x-1dscollectorurl: https://mobile.events.data.microsoft.com/OneCollector/1.0/
x-ariacollectorurl: https://browser.pipe.aria.microsoft.com/Collector/3.0/
x-aspnet-version: 4.0.30319
x-cache: CONFIG_NOCACHE
x-content-type-options: nosniff
x-databoundary: NONE
x-frame-options: SAMEORIGIN
x-ms-invokeapp: 1; RequireReadOnly
x-msedge-ref: Ref A: 038A3F80BB8F4B3C8E488C7C34C6D907 Ref B: BL2AA2030105053 Ref C: 2024-07-15T20:47:47Z
x-networkstatistics: 0,525568,0,0,625878,0,75160,22
x-powered-by: ASP.NET
x-sharepointhealthscore: 3
x-sp-serverstate: ReadOnly=0
{
"odata.metadata": "https://:censored:19:d1eaf39465:.sharepoint.com/sites/QCPostOffice/_api/$metadata#SP.ApiData.Folders1/@Element",
"odata.type": "SP.Folder",
"odata.id": "https://:censored:19:d1eaf39465:.sharepoint.com/sites/QCPostOffice/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/QCPostOffice/Shared Documents/Test Folder to Delete')",
"odata.editLink": "Web/GetFolderByServerRelativePath(decodedurl='/sites/QCPostOffice/Shared%20Documents/Test%20Folder%20to%20Delete')",
"Exists": true,
"ExistsAllowThrowForPolicyFailures": true,
"ExistsWithException": true,
"IsWOPIEnabled": false,
"ItemCount": 4,
"Name": "Test Folder to Delete",
"ProgID": null,
"ServerRelativeUrl": "/sites/QCPostOffice/Shared Documents/Test Folder to Delete",
"TimeCreated": "2024-07-15T18:54:35Z",
"TimeLastModified": "2024-07-15T20:14:52Z",
"UniqueId": "860797c5-219f-406f-b231-df4db60cd86e",
"WelcomePage": ""
}