M-Files API 22.6.11519.0
VaultObjectOperations Object
Members 
Description
A group of methods for creating and modifying objects.
Public Methods
Adds the specified object to the 'Favorites' view of the current user.
Adds the specified objects to the 'Favorites' view of the current user.
Changes the permissions for the specified object.
Changes the permissions for the specified object.
Checks in the object.
Checks in multiple objects at once.
Checks out the object.
Checks out multiple objects at once.
Compares the content of this document with the content of another one.
Compares the content of this document version with the content of another one. Use the CompareWithAnotherVersionEx method for multi-file document support.
Compares the content of this document version with the content of another one.
Compares the content of this document version with the content of the previous one. Use the CompareWithPreviousVersionEx method for multi-file document support.
Compares the content of this document version with the content of the previous one.
Saves a copy of the deleted conflict object as a new version of the related base object.
Creates a new assignment.
Creates a new single-file document based on the specified properties and source files.
Creates a new object based on the specified properties and source files.
Creates a new object based on the specified properties and source files.
Creates a new object based on the specified properties and source files.
Creates a new single file object based on the specified properties and source file.
Creates a new single file object based on the specified properties and source file.
Performs check-in operation for the object after any of the object's files are no longer in use.
Deletes the specified object.
Destroys an object or a specific version of the object. Prefer DestroyObjectEx as its parameter ObjectVersion supports unmanaged external repository objects.
Destroys the specified object, or a specific version of the object.
Destroys the specified objects.
Starts or stops following the specified object. While the object is being followed, the current user will be notified if the object changes.
Performs undo checkout and enforces the operation if the user has permission to perform forced undo checkout.
Gets all the collection members of the specified collection.
Gets the history of the specified object. Use GetHistoryEx for additional options.
Gets the extended history of the specified object with search parameters.
Gets the latest version and properties of the specified object.
Gets the latest version of the specified object.
Gets the latest version of the specified object. Optionally notifies M-Files windows to update the object in their listings.
Gets an M-Files URL for the specified object.
Gets an M-Files URL for the specified object.
Gets an M-Files URL for the specified object or file.
Gets an M-Files URL for the specified object or file.
Receives the requested information of the specified objects.
Gets the Object GUID of the specified object.
Gets information on the specified object version.
Gets information on the specified object version. Optionally notifies M-Files windows to update the object in their listings.
Gets the locations of the object in a view.
Gets the permissions for the specified object.
Gets the information on and properties of the specfied object version.
Gets the object version and properties of the specified objects.
Gets the Object ID of the object that is identified by the specified Object GUID.
Gets the Object ID of the object that is identified by the specified Original Vault GUID and Original Object ID.
Gets the offline availability of the specified object.
Gets the IDs of the objects set to be available offline.
Gets information related to the specified lookup property.
Gets all the relationships of the specified object.
Gets all the relationships of the specified object.
Gets the thumbnail for the specified object in PNG format.
Checks whether the specified object is checked out to any user on any computer.
Checks whether the specified object is checked out to this user on this computer.
Checks whether the specified object is currently followed by the current user.
Checks whether the specified object version is a single-file or multi-file document.
Checks whether the specified object matches the search conditions. Any field expression in search conditions is not supported.
Checks whether the specified object and properties match the search conditions. Any field expression in search conditions is not supported.
Notifies M-Files that an object has been accessed. This will add the object to the Recently Accessed by Me view of the user.
Proposes checkout operation for the object file. System may prompt for checkout. Returns error on cancel.
Prevents implicitly or explicitly triggered checkin reminder from calling process.
Removes the specified object from the 'Favorites' view of the current user.
Removes the specified objects from the 'Favorites' view of the current user.
Resolves a conflict that involves the specified participant object. Returns the affected objects. Do not use this method if the vault uses automatic conflict resolution.
Rolls back the specified object to the specified version. Prefer RollbackEx as its parameter RollbackToVersion supports unmanaged external repository objects.
Rolls back the specified object to the specified version.
Sets the external ID for an object. The object itself must be internal.
Sets the Object GUID of the specified object.
Marks the specified object for offline availability, or clears the offline availability marker.
Changes the single-file status of the specified object.
Displays the edit object metadata window.
Displays the new object metadata window.
Displays the 'Change State' dialog box for the object.
Displays the checkin reminder for the specified object. Can fail if the object is open in another program.
Displays a modal checkin reminder dialog for the specified object. Does not perform the actual check in operation. Returns error on cancel.
Displays the object checkout prompt for the user.
Displays the collection members dialog box for the object.
Displays the comments dialog box for the object.
Displays the edit object metadata window.
Displays the history dialog box for the object.
Displays the new object metadata window.
Displays a new object metadata window.
Shows related objects for the object by target object type in Windows Explorer.
Displays the relationships dialog box for the object.
Displays the history dialog box for the object.
Displays the sub-objects dialog box for the object.
Undeletes the specified object.
Performs undo checkout for the specified object version.
Performs undo checkout for the specified object versions.
Remarks
This method group interface can be accessed via the Vault object.
Example
' Identify the object.
Dim oObjVer As MFilesAPI.ObjVer
'...

' Get the version data and check if the object version is checked out. If the version is checked out, it must be
' checked out for current user -- otherwise the version wouldn't be visible for the user.
Dim oObjectVersionAndProperties As MFilesAPI.ObjectVersionAndProperties = _
    oVault.ObjectOperations.GetObjectVersionAndProperties(oObjVer)

If oObjectVersionAndProperties.VersionData().ThisVersionCheckedOut() Then
'     This object is checked out for current user.
End If

' 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)
' Initialize the API and connect to a vault.
Dim oVault As MFilesAPI.Vault
' ...

' We are searching for the document with ID 123.
Dim iDocumentId As Integer
iDocumentId = 123

' Initialize an ObjID object for the search.
Dim oObjId As New MFilesAPI.ObjID
oObjId.SetIDs(MFilesAPI.MFBuiltInObjectType.MFBuiltInObjectTypeDocument, iDocumentId)

' Invoke the search operation.
Dim oObjectVersionCheckedOut As MFilesAPI.ObjectVersion
Dim oObjectVersionAndProperties As MFilesAPI.ObjectVersionAndProperties
oObjectVersionAndProperties = oVault.ObjectOperations.GetLatestObjectVersionAndProperties(oObjId, True)
oObjectVersionCheckedOut = oObjectVersionAndProperties.VersionData

' Get the info for all the versions of this document.
Dim oObjectVersions As MFilesAPI.ObjectVersions
oObjectVersions = oVault.ObjectOperations.GetHistory(oObjId)

' Check if this object version is checked out to the current user.
If oObjectVersionCheckedOut.ThisVersionCheckedOut Then
    Call Console.WriteLine("Document object: '" + oObjectVersionCheckedOut.GetNameForFileSystem() + "' [checked out to me]")
    Call Console.WriteLine("   Current version: " + CStr(oObjectVersionCheckedOut.ObjVer.Version))
    Call Console.WriteLine("   Checked out: " + oObjectVersionCheckedOut.CheckedOutAtUtc + " UTC")
    ' Try to resolve the previous version number before checkout.
    If oObjectVersions.Count > 1 Then
        Dim oObjectVersionOld As MFilesAPI.ObjectVersion = oObjectVersions.Item(oObjectVersions.Count - 1)
        Call Console.WriteLine("      Latest version before checkout identified by: " + CStr(oObjectVersionOld.ObjVer.Version))
    End If
Else
    Call Console.WriteLine("Document object: '" + oObjectVersionCheckedOut.GetNameForFileSystem() + "'")
End If

' Resolve the last modification timestamp of the object.
Dim dtObjectModification As Date = oObjectVersionCheckedOut.LastModifiedUtc
Call Console.WriteLine("   Object modified: " + CStr(dtObjectModification) + " UTC")

' Process the object files.
Dim oObjectFiles As MFilesAPI.ObjectFiles = oObjectVersionCheckedOut.Files
For Each oObjectFile As MFilesAPI.ObjectFile In oObjectFiles
    ' Construct the FileVer string for the file.
    Dim szFileVer = CStr(oObjectFile.ID) + "-" + CStr(oObjectFile.Version)
    ' Output the identification of the object file.
    Call Console.WriteLine("   Document file: '" + oObjectFile.GetNameForFileSystem() + "'")
    ' Resolve the last modification timestamp of the file content.
    Dim dtContentModification As Date = oObjectFile.LastAccessTimeUtc
    Call Console.WriteLine("      Currently identified by: " + szFileVer)
    ' Try to find the previous versions of the object files.
    If oObjectVersionCheckedOut.ThisVersionCheckedOut And oObjectVersions.Count > 1 Then
        Dim oObjectFilesOld As MFilesAPI.ObjectFiles = oObjectVersions.Item(oObjectVersions.Count - 1).Files
        For Each oObjectFileOld As MFilesAPI.ObjectFile In oObjectFilesOld
            If oObjectFileOld.ID = oObjectFile.ID Then
                ' Construct the FileVer string for the previous version of the file.
                Dim szFileVerOld = CStr(oObjectFileOld.ID) + "-" + CStr(oObjectFileOld.Version)
                Call Console.WriteLine("      Latest version before checkout identified by: " + szFileVerOld)
                Call Console.WriteLine("      File content modified: " + CStr(dtContentModification) + " UTC")
            End If
        Next
    End If
Next

See Also

VaultObjectOperations Members