Delete
Deleting a content is an http DELETE
request under the hood. You can call it by defining the content that you want to delete and setting whether the deleted item should be first moved to the trash or be deleted immediately. These DELETE
requests will return a JSON similar to the following. It contains the number of deleted items, basic info about the deleted item(s) and if some of the given contents cannot be deleted for some reason, there will be error messages listed in the errors
array:
{"d": {"__count": 1,"results": [{"Id": 1335,"Path": "/Root/Content/IT/Tasks/Debug","Name": "Debug"}],"errors": []}}
Delete a single content
The following example shows you how to delete a folder:
Delete multiple content at once
With the next example you can remove a bunch of documents at once:
Copy
url: "/OData.svc/Root/Content('IT')/DeleteBatch",
body: {
"paths":[
"/Root/Content/IT/Document_Library/Chicago/100Pages.docx",
"/Root/Content/IT/Document_Library/Chicago/VehicleLog.xlsx",
"/Root/Content/IT/Document_Library/Chicago/SalesTraining.pptx",
"/Root/Content/IT/Document_Library/Chicago/ComeCelebrate.pdf"
]
}
Move items to the trash
This example shows you how to move a content to the trash:
Copy
url: "/OData.svc/Root/Content/IT/Document_Library/Chicago('100Pages.docx')/Delete",
body: {
permanent: false
}