コード例 #1
0
ファイル: DMDocumentTest.cs プロジェクト: rexwhitten/edocs
        public void TestCreateAndDeleteDocument()
        {
            DMLogin.ServerName = DMTestEnvironment.Server;
            DMLogin.Password = TestHelperSecure.MyPassword;
            string dst = DMLogin.Dst;
            string newDocName = Guid.NewGuid().ToString();

            ProfileInfo profile = new ProfileInfo() { FormName = "STANDARD_P" };
            profile.Properties = new Dictionary<string, string>() {
                    { "DOCNAME", newDocName },
                    { "APP_ID", "NOTEPAD" },
                    { "AUTHOR_ID", "JDOE" },
                    { "TYPIST_ID", "JDOE" }
                };
            DMDocument doc = new DMDocument() { Dst = dst, Library = DMLogin.Library };

            string fileName = Path.GetTempFileName();
            File.WriteAllText(fileName, "hello world!\r\n");
            try {
                var docInfo = doc.CreateDocument(profile, fileName);
                Assert.IsNotNull(docInfo);
                Assert.IsTrue(docInfo.DocNumber > 0);
                Assert.IsTrue(docInfo.VersionID > 0);
                //TODO download content and check

                doc.DeleteProfile(docInfo.DocNumber);
            }
            finally {
                File.Delete(fileName);
            }
        }
コード例 #2
0
ファイル: DMDocumentTest.cs プロジェクト: rexwhitten/edocs
        public void TestCreateAndDeleteEmptyCustomProfile()
        {
            DMLogin.ServerName = DMTestEnvironment.Server;
            DMLogin.Password = TestHelperSecure.MyPassword;
            string newDocName = Guid.NewGuid().ToString();
            string dst = DMLogin.Dst;

            ProfileInfo profile = new ProfileInfo() { FormName = "CUSTOM_PROFILE_FORM" };
            profile.Properties = new Dictionary<string, string>() {
                { "DOCNAME", newDocName },
                { "APP_ID", "MS WORD" },
                { "AUTHOR_ID", "JDOE" },
                { "TYPIST_ID", "JDOE" },
                { "TYPE_ID", "REPORT" },
                { "CUSTOM_PROP", "NEW VAL" }
            };

            DMDocument doc = new DMDocument() { Dst = dst, Library = DMLogin.Library };

            // create
            var docInfo = doc.CreateProfile(profile);
            Assert.IsNotNull(docInfo);
            Assert.IsTrue(docInfo.DocNumber > 0);
            Assert.IsTrue(docInfo.VersionID > 0);

            // unlock (check-in). We are okay with creating a profile without a document file
            try {
                doc.UnlockDocument(docInfo);
            }
            catch(DMApiEmptyDocumentFileException) {
            }

            // delete
            doc.DeleteProfile(docInfo.DocNumber);
        }
コード例 #3
0
ファイル: DMDocumentTest.cs プロジェクト: rexwhitten/edocs
        public void TestCreateFolder_LinkToFolder_DeleteFolder()
        {
            DMLogin.ServerName = DMTestEnvironment.Server;
            DMLogin.Password = TestHelperSecure.MyPassword;
            string newDocName = Guid.NewGuid().ToString();
            string dst = DMLogin.Dst;

            ProfileInfo profile = new ProfileInfo() { FormName = "STANDARD_P" };
            profile.Properties = new Dictionary<string, string>() {
                    { "DOCNAME", newDocName },
                    { "APP_ID", "FOLDER" },
                    { "AUTHOR_ID", "JDOE" },
                    { "TYPIST_ID", "NKHORIN" }
                };

            DMDocument doc = new DMDocument() { Dst = dst, Library = DMLogin.Library };

            // create
            var docInfo = doc.CreateProfile(profile);
            Assert.IsNotNull(docInfo);
            Assert.IsTrue(docInfo.DocNumber > 0);
            Assert.IsTrue(docInfo.VersionID > 0);

            try {
                // no need to unlock a folder

                // link to an existing folder (we looked up its DOCNUMBER and VERSIONID)
                var parent = new DocumentInfo { DocNumber = 12070617, VersionID = 12681993 };
                doc.AddLink(docInfo.DocNumber, parent);
            }
            finally {
                // clear links and delete
                doc.DeleteProfile(docInfo.DocNumber, true);
            }
        }
コード例 #4
0
ファイル: DMDocumentTest.cs プロジェクト: rexwhitten/edocs
        public void TestCreateAndDeleteFolder()
        {
            DMLogin.ServerName = DMTestEnvironment.Server;
            DMLogin.Password = TestHelperSecure.MyPassword;
            string newDocName = Guid.NewGuid().ToString();
            string dst = DMLogin.Dst;

            ProfileInfo profile = new ProfileInfo() { FormName = "STANDARD_P" };
            profile.Properties = new Dictionary<string, string>() {
                    { "DOCNAME", newDocName },
                    { "APP_ID", "FOLDER" },
                    { "AUTHOR_ID", "JDOE" },
                    { "TYPIST_ID", "JDOE" }
                };
            profile.Trustees = new List<TrusteeInfo>() {
                new TrusteeInfo("DOCS_USERS", TrusteeType.Group, AccessRights.ReadOnly)
            };

            DMDocument doc = new DMDocument() { Dst = dst, Library = DMLogin.Library };

            // create
            var docInfo = doc.CreateProfile(profile);
            Assert.IsNotNull(docInfo);
            Assert.IsTrue(docInfo.DocNumber > 0);
            Assert.IsTrue(docInfo.VersionID > 0);

            // no need to unlock a folder

            // delete
            doc.DeleteProfile(docInfo.DocNumber);
        }