public IObjectData CreateDocument(string folderId, string name, string content) { DotCMIS.Data.Impl.Properties properties = new DotCMIS.Data.Impl.Properties(); PropertyData objectTypeIdProperty = new PropertyData(PropertyType.Id); objectTypeIdProperty.Id = PropertyIds.ObjectTypeId; objectTypeIdProperty.Values = new List <object>(); objectTypeIdProperty.Values.Add(DefaultDocumentType); properties.AddProperty(objectTypeIdProperty); PropertyData nameProperty = new PropertyData(PropertyType.String); nameProperty.Id = PropertyIds.Name; nameProperty.Values = new List <object>(); nameProperty.Values.Add(name); properties.AddProperty(nameProperty); ContentStream contentStream = null; if (content != null) { byte[] bytes = Encoding.UTF8.GetBytes(content); contentStream = new ContentStream(); contentStream.FileName = name; contentStream.MimeType = "text/plain"; contentStream.Stream = new MemoryStream(bytes); contentStream.Length = bytes.Length; } string newDocId = Binding.GetObjectService().CreateDocument(RepositoryInfo.Id, properties, folderId, contentStream, null, null, null, null, null); Assert.NotNull(newDocId); IObjectData doc = GetFullObject(newDocId); Assert.NotNull(doc); Assert.NotNull(doc.Id); Assert.AreEqual(BaseTypeId.CmisDocument, doc.BaseTypeId); Assert.NotNull(doc.Properties); Assert.NotNull(doc.Properties[PropertyIds.ObjectTypeId]); Assert.AreEqual(PropertyType.Id, doc.Properties[PropertyIds.ObjectTypeId].PropertyType); Assert.AreEqual(DefaultDocumentType, doc.Properties[PropertyIds.ObjectTypeId].FirstValue as string); Assert.NotNull(doc.Properties[PropertyIds.Name]); Assert.AreEqual(PropertyType.String, doc.Properties[PropertyIds.Name].PropertyType); Assert.AreEqual(name, doc.Properties[PropertyIds.Name].FirstValue as string); if (folderId != null) { CheckObjectInFolder(newDocId, folderId); } return(doc); }
public IObjectData CreateFolder(string folderId, string name) { DotCMIS.Data.Impl.Properties properties = new DotCMIS.Data.Impl.Properties(); PropertyData objectTypeIdProperty = new PropertyData(PropertyType.Id); objectTypeIdProperty.Id = PropertyIds.ObjectTypeId; objectTypeIdProperty.Values = new List <object>(); objectTypeIdProperty.Values.Add(DefaultFolderType); properties.AddProperty(objectTypeIdProperty); PropertyData nameProperty = new PropertyData(PropertyType.String); nameProperty.Id = PropertyIds.Name; nameProperty.Values = new List <object>(); nameProperty.Values.Add(name); properties.AddProperty(nameProperty); string newFolderId = Binding.GetObjectService().CreateFolder(RepositoryInfo.Id, properties, folderId, null, null, null, null); Assert.NotNull(newFolderId); IObjectData folder = GetFullObject(newFolderId); Assert.NotNull(folder); Assert.NotNull(folder.Id); Assert.AreEqual(BaseTypeId.CmisFolder, folder.BaseTypeId); Assert.NotNull(folder.Properties); Assert.NotNull(folder.Properties[PropertyIds.ObjectTypeId]); Assert.AreEqual(PropertyType.Id, folder.Properties[PropertyIds.ObjectTypeId].PropertyType); Assert.AreEqual(DefaultFolderType, folder.Properties[PropertyIds.ObjectTypeId].FirstValue as string); Assert.NotNull(folder.Properties[PropertyIds.Name]); Assert.AreEqual(PropertyType.String, folder.Properties[PropertyIds.Name].PropertyType); Assert.AreEqual(name, folder.Properties[PropertyIds.Name].FirstValue as string); if (folderId != null) { CheckObjectInFolder(newFolderId, folderId); } return(folder); }
public IObjectData CreateFolder(string folderId, string name) { DotCMIS.Data.Impl.Properties properties = new DotCMIS.Data.Impl.Properties(); PropertyData objectTypeIdProperty = new PropertyData(PropertyType.Id); objectTypeIdProperty.Id = PropertyIds.ObjectTypeId; objectTypeIdProperty.Values = new List<object>(); objectTypeIdProperty.Values.Add(DefaultFolderType); properties.AddProperty(objectTypeIdProperty); PropertyData nameProperty = new PropertyData(PropertyType.String); nameProperty.Id = PropertyIds.Name; nameProperty.Values = new List<object>(); nameProperty.Values.Add(name); properties.AddProperty(nameProperty); string newFolderId = Binding.GetObjectService().CreateFolder(RepositoryInfo.Id, properties, folderId, null, null, null, null); Assert.NotNull(newFolderId); IObjectData folder = GetFullObject(newFolderId); Assert.NotNull(folder); Assert.NotNull(folder.Id); Assert.AreEqual(BaseTypeId.CmisFolder, folder.BaseTypeId); Assert.NotNull(folder.Properties); Assert.NotNull(folder.Properties[PropertyIds.ObjectTypeId]); Assert.AreEqual(PropertyType.Id, folder.Properties[PropertyIds.ObjectTypeId].PropertyType); Assert.AreEqual(DefaultFolderType, folder.Properties[PropertyIds.ObjectTypeId].FirstValue as string); Assert.NotNull(folder.Properties[PropertyIds.Name]); Assert.AreEqual(PropertyType.String, folder.Properties[PropertyIds.Name].PropertyType); Assert.AreEqual(name, folder.Properties[PropertyIds.Name].FirstValue as string); if (folderId != null) { CheckObjectInFolder(newFolderId, folderId); } return folder; }
public IObjectData CreateDocument(string folderId, string name, string content) { DotCMIS.Data.Impl.Properties properties = new DotCMIS.Data.Impl.Properties(); PropertyData objectTypeIdProperty = new PropertyData(PropertyType.Id); objectTypeIdProperty.Id = PropertyIds.ObjectTypeId; objectTypeIdProperty.Values = new List<object>(); objectTypeIdProperty.Values.Add(DefaultDocumentType); properties.AddProperty(objectTypeIdProperty); PropertyData nameProperty = new PropertyData(PropertyType.String); nameProperty.Id = PropertyIds.Name; nameProperty.Values = new List<object>(); nameProperty.Values.Add(name); properties.AddProperty(nameProperty); ContentStream contentStream = null; if (content != null) { byte[] bytes = Encoding.UTF8.GetBytes(content); contentStream = new ContentStream(); contentStream.FileName = name; contentStream.MimeType = "text/plain"; contentStream.Stream = new MemoryStream(bytes); contentStream.Length = bytes.Length; } string newDocId = Binding.GetObjectService().CreateDocument(RepositoryInfo.Id, properties, folderId, contentStream, null, null, null, null, null); Assert.NotNull(newDocId); IObjectData doc = GetFullObject(newDocId); Assert.NotNull(doc); Assert.NotNull(doc.Id); Assert.AreEqual(BaseTypeId.CmisDocument, doc.BaseTypeId); Assert.NotNull(doc.Properties); Assert.NotNull(doc.Properties[PropertyIds.ObjectTypeId]); Assert.AreEqual(PropertyType.Id, doc.Properties[PropertyIds.ObjectTypeId].PropertyType); Assert.AreEqual(DefaultDocumentType, doc.Properties[PropertyIds.ObjectTypeId].FirstValue as string); Assert.NotNull(doc.Properties[PropertyIds.Name]); Assert.AreEqual(PropertyType.String, doc.Properties[PropertyIds.Name].PropertyType); Assert.AreEqual(name, doc.Properties[PropertyIds.Name].FirstValue as string); if (folderId != null) { CheckObjectInFolder(newDocId, folderId); } return doc; }