Exemplo n.º 1
0
        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);
            }
        }