Exemple #1
0
        public CMISFolder GetSubfolder(CMISFolder baseFolder, string pathExtension, string folderType)
        {
            IDictionary <string, object> props = new Dictionary <string, object>();

            props["cmis:objectTypeId"] = folderType;

            IFolder currFolder = baseFolder.IFolder(session);

            foreach (string element in pathExtension.Split('/'))
            {
                if (element == string.Empty)
                {
                    continue;                          // ignore leadiong "/"
                }
                List <ICmisObject> childs = currFolder.GetChildren().Where(n => n.Name == element && n is IFolder).ToList();
                if (childs.Count > 0)
                {
                    // if subfolder already exists -> use it
                    currFolder = (IFolder)childs[0];
                    continue;
                }
                // else create it
                props[PropertyIds.Name] = element;
                currFolder = currFolder.CreateFolder(props);
            }
            return(new CMISFolder(currFolder, session));
        }
Exemple #2
0
        public CMISDocument GetDocument(CMISFolder folder, string documentName)
        {
            List <ICmisObject> found = folder.IFolder(session).GetChildren().Where(n => n.Name == documentName && n is IDocument).ToList();

            if (found == null || found.Count == 0)
            {
                return(null);
            }
            return(new CMISDocument(found.First() as IDocument));
        }
Exemple #3
0
        public void StoreDocument(
            CMISFolder folder,                  // where to put the document
            string document,                    // file name of the document
            string docName,                     // name of the new document
            Dictionary <string, object> props,  // document properties
            bool?major)                         // use versioning and which one
        {
            IContentStream contentStream = getContentStream(document, docName);

            try
            {
                IFolder         iFolder = folder.IFolder(session);
                VersioningState?vs      = null;
                if (major != null)
                {
                    vs = major == true? VersioningState.Major : VersioningState.Minor;
                }
                props[PropertyIds.Name] = docName;
                iFolder.CreateDocument(props, contentStream, vs);
                props.Remove(PropertyIds.Name);
            }
            catch (CmisBaseException e) { throw new Exception(e.Message + "\n" + e.ErrorContent); }
            finally { contentStream.Stream.Dispose(); }
        }
Exemple #4
0
 public void DeleteFolder(CMISFolder folder)
 {
     session.Delete(folder.IFolder(session));
 }