The collection of the source files for the new object.
In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.
The access control list for the new object.
In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.
Visual Basic |
---|
Public Function CreateNewObject( _ ByVal ObjectType As Long, _ ByVal PropertyValues As PropertyValues, _ Optional ByVal SourceObjectFiles As SourceObjectFiles = 0, _ Optional ByVal AccessControlList As AccessControlList = 0 _ ) As ObjectVersionAndProperties |
The collection of the source files for the new object.
In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.
The access control list for the new object.
In scripting languages, a specific null value (e.g., Nothing in VBScript) should be used to indicate the default value.
' Create property definitions Dim oPropertyValues As MFilesAPI.PropertyValues = New MFilesAPI.PropertyValues ' Add 'Name and Title' property by creating a new PropertyValue object. ' The PropertyValue object encapsulates the metadata information (PropertyDef) ' and the actual value (TypedValue). Dim oPropertyValue1 As MFilesAPI.PropertyValue = New MFilesAPI.PropertyValue oPropertyValue1.PropertyDef = MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefNameOrTitle oPropertyValue1.TypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeText, "DemoObject") oPropertyValues.Add(0, oPropertyValue1) ' Add 'Class' property Dim oPropertyValue2 As MFilesAPI.PropertyValue = New MFilesAPI.PropertyValue oPropertyValue2.PropertyDef = MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefClass oPropertyValue2.TypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeLookup, _ MFilesAPI.MFBuiltInDocumentClass.MFBuiltInDocumentClassOtherDocument) oPropertyValues.Add(1, oPropertyValue2) ' Add 'Single file' property Dim oPropertyValue3 As MFilesAPI.PropertyValue = New MFilesAPI.PropertyValue oPropertyValue3.PropertyDef = MFilesAPI.MFBuiltInPropertyDef.MFBuiltInPropertyDefSingleFileObject oPropertyValue3.TypedValue.SetValue(MFilesAPI.MFDataType.MFDatatypeBoolean, True) oPropertyValues.Add(2, oPropertyValue3) ' Add source file. Dim oSourceFiles As MFilesAPI.SourceObjectFiles = New MFilesAPI.SourceObjectFiles Dim oSourceFile1 As MFilesAPI.SourceObjectFile = New MFilesAPI.SourceObjectFile oSourceFile1.SourceFilePath = "c:\demo.txt" oSourceFile1.Title = "demo" oSourceFile1.Extension = "txt" oSourceFiles.Add(0, oSourceFile1) ' Create new object. Dim oObjectVersionAndProperties As MFilesAPI.ObjectVersionAndProperties oObjectVersionAndProperties = m_vault.ObjectOperations.CreateNewObject( _ MFilesAPI.MFBuiltInObjectType.MFBuiltInObjectTypeDocument, _ oPropertyValues, oSourceFiles) ' Check in the newly created object. m_vault.ObjectOperations.CheckIn(oObjectVersionAndProperties.ObjVer)