Use case: Delete an attachment from an annotation
Before you start
Before you delete an attachment from an annotation, ensure you have completed the following prerequisites:
- Verify Permissions: Confirm that you have the necessary rights to remove attachments from annotations. This typically requires being the original attachment creator, the annotation owner, or having appropriate administrative permissions.
- Identify the Attachment: Determine exactly which attachment needs to be deleted. You'll need its unique identifier to perform this action.
- Consider Implications: Be aware that deleting an attachment is typically permanent and cannot be undone. Any references to the attachment in discussions or replies will become invalid.
- Inform Stakeholders: If the attachment is important to ongoing discussions, consider notifying team members before removing it or adding a reply to explain why it was removed.
- Set Up SDK Environment: Ensure your Unity environment is properly configured with the Collaboration SDK to interact with the annotation system.
How do I...?
Delete a specific attachment by ID
To remove a single attachment from an annotation:
- Obtain the Project Identifier: Ensure you have the correct project identifier (GUID) for the project.
- Obtain the Annotation Identifier: Ensure you have the correct annotation identifier (GUID) for the annotation that owns the attachment.
- Obtain the Attachment ID: Ensure you have the unique identifier for the specific attachment you want to delete.
- Call the Delete Method: Use the SDK to delete the attachment.
Example:
await annotationManagement.DeleteAttachmentAsync(
projectId: projectId,
annotationId: annotationId,
attachmentId: attachmentId,
cancellationToken: cancellationToken);
- Handle Response: Verify that the deletion was successful and handle any errors appropriately.
- Update UI: If your application has a user interface displaying attachments, refresh it to reflect the removal.
- Handle Edge Cases: Account for scenarios such as already-deleted attachments or permission issues.
Note
Deleting attachments permanently removes the associated files or links from the annotation. This can help keep discussions focused and reduce clutter, but should be done carefully to avoid losing valuable context or reference materials.
For more information on working with attachments, see the documentation on creating attachments and updating attachments.