I'm using the DFSDotNetSamples solution as my starting point.
I've found this thread (https://community.emc.com/thread/145843) which is asking a similar question and suggests using relationships which is what I'm trying to do without success.
This code works and creates a folder in the home cabinet.
ObjectIdentity folderIdentity = new ObjectIdentity();
folderIdentity.RepositoryName = DefaultRepository;
DataObject dataObject = new DataObject(folderIdentity, "dm_folder");
string newFolder = "Ticks" + System.DateTime.Now.Ticks.ToString();
PropertySet properties = new PropertySet();
properties.Set("object_name", newFolder);
dataObject.Properties = properties;
DataPackage dataPackage = new DataPackage(dataObject);
OperationOptions operationOptions = null;
return objectService.Create(dataPackage, operationOptions);
This code doesnt work and gives an error. The "MyTestCabinet" exists already.
ObjectPath objectPath = new ObjectPath("/MyTestCabinet");
ObjectIdentity folderIdentity = new ObjectIdentity(objectPath, DefaultRepository);
var folderRelationship = new ReferenceRelationship();
folderRelationship.Target = folderIdentity;
folderRelationship.Name = Relationship.RELATIONSHIP_FOLDER;
folderRelationship.TargetRole = Relationship.ROLE_PARENT;
// tried this as well
//folderRelationship.Name = Relationship.RELATIONSHIP_FOLDER;
//folderRelationship.TargetRole = Relationship.ROLE_CHILD;
string newFolder = "Ticks" + System.DateTime.Now.Ticks.ToString();
PropertySet properties = new PropertySet();
properties.Set("object_name", newFolder);
DataObject dataObject = new DataObject(folderIdentity, "dm_folder");
dataObject.Properties = properties;
dataObject.Relationships.Add(folderRelationship);
DataPackage dataPackage = new DataPackage(dataObject);
OperationOptions operationOptions = null;
return objectService.Create(dataPackage, operationOptions);
I have used objectService.CreatePath(objPath, DefaultRepository); to create a folder within a folder but I need to create folder with a particular custom type, ie I'll be changing "dm_folder" to "my_custom_folder_type"
The error is.
NUnit.Framework.AssertionException was unhandled
Message=Failed with exception "Create" operation failed for object: [Ticks634871958797600946] [id =com.emc.documentum.fs.datamodel.core.ObjectPath@4440982b] PROPERTIES [object_name=Ticks634871958797600946].
Source=nunit.framework
StackTrace:
at NUnit.Framework.Assert.Fail(String message, Object[] args)
at NUnit.Framework.Assert.Fail(String message)
at Emc.Documentum.FS.Doc.Samples.Client.Test.TObjectServiceDemo.MyTestCreateNewFolder() in C:\_____\xxxxx\Src\POC\DocumentumConnection\DfsDotNetSamples\DfsDotNetSamples\DotNetDocSamplesTest\TObjectServiceDemo.cs:line 104
at Emc.Documentum.FS.Doc.Samples.Client.Test.TestRunner.objectServiceTests() in C:\_____\xxxxx\Src\POC\DocumentumConnection\DfsDotNetSamples\DfsDotNetSamples\DotNetDocSamplesTest\program.cs:line 55
at Emc.Documentum.FS.Doc.Samples.Client.Test.TestRunner.Main() in C:\_____\xxxxx\Src\POC\DocumentumConnection\DfsDotNetSamples\DfsDotNetSamples\DotNetDocSamplesTest\program.cs:line 16
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: