Use the delete
method to delete a directory.
try {
const id = 'directory_id_here'; // The ID of the directory to delete.
const [data, error] = await sdk.directory.delete({
id
});
// Check for success
if (error) {
console.error('Failed to delete the directory:', error);
} else {
console.log(`Directory with ID ${id} has been deleted.`);
}
} catch (error) {
console.error('An unexpected error occurred:', error.message);
}
Params
directoryId
- The ID of the directory you want to delete.
Required API Key Permission
Delete Directory