Deleting Objects
Allowable Actions
Before you delete an object, check the Allowable Actions to determine if the current user is allowed to delete the object.
Deleting Objects
The following snippet deletes an object. If the object is a document, all versions of the document are deleted. If the object is a folder and it is not empty, a constraint exception is thrown.
OpenCMIS (Java)
CmisObject cmisObject = ...
cmisObject.delete();
PortCMIS (C#)
ICmisObject cmisObject = ...
cmisObject.Delete();
Deleting Documents and Versions
If a document is versioned, the whole version series can be deleted or just a single version. This is controlled with the allVersions
parameter.
For documents that are not versioned it doesn’t matter if the allVersions
parameter is set to true
or false
.
Deleting a Document and All Versions
To delete a whole version series, set the allVersions
to true
.
OpenCMIS (Java)
Document document = ...
document.delete(true); // allVersions = true
PortCMIS (C#)
IDocument document = ...
document.Delete(true); // allVersions = true
Deleting a Single Version
To delete one version with a version series, set the allVersions
to false
.
OpenCMIS (Java)
Document document = ...
document.delete(false); // allVersions = false
PortCMIS (C#)
IDocument document = ...
document.Delete(false); // allVersions = false
Deleting a Folder Hierarchy
OpenCMIS (Java)
Folder folder = ...
folder.deleteTree(true, UnfileObject.DELETE, true);
PortCMIS (C#)
IFolder folder = ...
folder.DeleteTree(true, UnfileObject.Delete, true);