/// <summary> /// Deletes document collaborator /// </summary> public static void DeleteCollaborator() { try { //ExStart:DeleteCollaborator // Create repository path finder IRepositoryPathFinder pathFinder = new RepositoryPathFinder(); var userRepository = new UserRepository(pathFinder); var documentRepository = new DocumentRepository(pathFinder); // Create instance of annotator IAnnotator annotator = new Annotator( userRepository, documentRepository, new AnnotationRepository(pathFinder), new AnnotationReplyRepository(pathFinder), new AnnotationCollaboratorRepository(pathFinder)); // Create a user that will be an owner. // Get user from the storage var owner = userRepository.GetUserByEmail("*****@*****.**"); // If user doesn’t exist in the storage then create it. if (owner == null) { userRepository.Add(new User { FirstName = "John", LastName = "Doe", Email = "*****@*****.**" }); owner = userRepository.GetUserByEmail("*****@*****.**"); } // Get document data object in the storage var document = documentRepository.GetDocument("Document.pdf"); // If document already created or it hasn’t owner then delete document if (document != null && document.OwnerId != owner.Id) { documentRepository.Remove(document); document = null; } // Get document id if document already created or create new document long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf", DocumentType.Pdf, owner.Id); // Create reviewer. var reviewerInfo = new ReviewerInfo { PrimaryEmail = "*****@*****.**", //user email, unique identifier FirstName = "Judy", LastName = "Doe", AccessRights = AnnotationReviewerRights.All }; // Delete collaborator var deleteCollaboratorResult = annotator.DeleteCollaborator(documentId, reviewerInfo.PrimaryEmail); //ExEnd:DeleteCollaborator } catch (Exception exp) { Console.WriteLine(exp.Message); } }