This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VBScript for original folder name

 Hi

I tried to find solution for saving the original name from the folders.  (not all the path)

I found way to save with VBScript the Date modified, and I want to find with the same way solution for the name.

Script for the Date modified:

Option Explicit

 

Dim oObjVer : SET oObjVer = CreateObject("MFilesAPI.ObjVer")

oObjVer.SetObjIDAndVersion ObjVer.ObjID,1

Dim oPVs: Set oPVs = Vault.ObjectPropertyOperations.GetProperties(oObjVer)

Dim addDate: Set addDate = oPVs.SearchForProperty(MFBuiltInPropertyDefLastModified). TypedValue

Output = addDate

 

**I'm trying to find a way to add the name not to the defined property of "name or title" because then it must be the title of the document.

Thanks

  • Hi,

    You can try something like this:

    Dim oObjVer : SET oObjVer = CreateObject("MFilesAPI.ObjVer")
    
    oObjVer.SetObjIDAndVersion ObjVer.ObjID,1
    
    Dim oPVs: Set oPVs = Vault.ObjectPropertyOperations.GetProperties(oObjVer)
    On Error Resume Next
    Dim OriginalFileName: OriginalFileName= oPVs.SearchForProperty(MFBuiltInPropertyDefOriginalPath).TypedValue.DisplayValue
    ErrNo = Err.Number
    On Error Goto 0
    If ErrNo = 0 Then
    	OriginalFileName = Split(OriginalFileName,"\")(UBound(Split(OriginalFileName,"\")))
    	OriginalFileName = Left(OriginalFileName,Len(OriginalFileName)-1)
    Else
    	OriginalFileName = ""
    End If
    
    OUTPUT = OriginalFileName

  • Great!!

    it is working perfect!

    Thanks :)