Exemple #1
0
        /// <summary>
        /// Assigns/sets document access rights
        /// </summary>
        public static void AssignAccessRights()
        {
            try
            {
                //ExStart:AssignAccessRight
                // Creat path finder
                IRepositoryPathFinder pathFinder = new RepositoryPathFinder();
                var documentRepository           = new DocumentRepository(pathFinder);

                // Create instance of annotator
                IAnnotator annotator = new Annotator(
                    new UserRepository(pathFinder),
                    new DocumentRepository(pathFinder),
                    new AnnotationRepository(pathFinder),
                    new AnnotationReplyRepository(pathFinder),
                    new AnnotationCollaboratorRepository(pathFinder));


                // Create document data object in storage.
                var  document   = documentRepository.GetDocument("Document.pdf");
                long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf");

                // Set document access rights
                annotator.SetDocumentAccessRights(documentId, AnnotationReviewerRights.All);
                //ExEnd:AssignAccessRight
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }