/// <summary> /// Gets document collaborator /// </summary> public static void GetCollaborator() { try { //ExStart:GetCollaborator // 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 }; // Get document collaborators. var getCollaboratorsResult = annotator.GetCollaborators(documentId); // Get document collaborator by email var getCollaboratorsResultByEmail = annotator.GetDocumentCollaborator(documentId, reviewerInfo.PrimaryEmail); // Get collaborator metadata var user = userRepository.GetUserByEmail(reviewerInfo.PrimaryEmail); ReviewerInfo collaboratorMetadataResult = annotator.GetCollaboratorMetadata(user.Guid); //ExEnd:GetCollaborator } catch (Exception exp) { Console.WriteLine(exp.Message); } }