Use the rename
method to rename a directory.
try {
const id = 'directory_id_here'; // The ID of the directory to rename.
const name = 'new_directory_name'; // The new name for the directory.
const [data, error] = await sdk.directory.rename({
id,
name
});
// Check for success
if (error) {
console.error('Failed to rename the directory:', error);
} else {
console.log(`Directory renamed to: ${name}`);
}
} catch (error) {
console.error('An unexpected error occurred:', error.message);
}
Params
id
- The ID of the directory you want to rename.name
- The new name for the directory.
Required API Key Permission
Create Directory
orDelete Directory