Use the delete
method to remove emails from invite-only access to a specific file.
try {
const fileId = 'file_id_here'; // The ID of the file for which you want to remove invite-only access.
const cid = 'content_identifier_here'; // The content identifier (CID) for accessing the file.
// Define the access information for removal.
const accessInfo = {
email: '[email protected]', // The email of the user to remove from invite-only access.
deleteAll: false // (optional) Set to `true` to remove all invitees, or `false` to remove access for a specific user.
};
const [deleteResult, error] = await sdk.fileAccess.delete({
fileId,
cid,
body: accessInfo
});
// Check for success
if (error) {
console.error('Failed to remove email from invite-only access:', error);
} else {
console.log(`Email ${accessInfo.email} removed from invite-only access successfully.`, deleteResult);
}
} catch (error) {
console.error('An unexpected error occurred while removing email from invite-only access:', error.message);
}
Params
fileId
(string): The ID of the file for which you want to verify access.cid
(string): The content identifier (CID) for accessing the file.body
(object): An object containing the email of the user from whom you want to remove access and an optional deleteAll flag.
Required API Key Permission
Upload File