This function returns the version of the source file on the specified date.
object.GetVersionByDate(aDate)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISSourceFile interface |
|
aDate |
In, Required | DateTime |
The date for the file version
selection |
Put the selected source file into the source store and display some information about its current version and its version on the specified date.
sub main
Dim aTr
Dim aStore
Dim aDialogue
Dim aStream
Dim aStoredFileName
Dim aFile
Dim aVersion
Dim aMessage
set aTr = Profile.StartMapTransaction
set aStore = Profile.SourceStore
EnsureFolder aStore, "Pictures"
set aDialogue = Profile.CreateOpenDialog
aDialogue.Title = "Select File for adding into Source Store"
aDialogue.Filter = "*.txt||*.rtf||*.doc||*.*||"
aDialogue.FileName = "*.*"
if not aDialogue.Execute then exit sub
set aStream = Profile.MakeStream
aStream.LoadFromFile(aDialogue.FileName)
aStoredFileName = "Examples\" & Mid(aDialogue.FileName, InStrRev(aDialogue.FileName, "\") + 1)
set aFile = aStore.PutFile(aStoredFileName, aStream, "The text of the example")
aTr.Snapshot
aMessage = "------------- CURRENT VERSION ------" & vbNewLine & GetFileInfo(aFile)
set aVersion = aFile.GetVersionByDate(#10/22/2019#)
if not aVersion is nothing then
aMessage = aMessage & vbNewLine & "-------- VERSION ON DATE -------" &_
GetFileInfo(aVersion)
else
aMessage = aMessage & vbNewLine & "----- VERSION ON DATE DOESN'T EXIST ----"
end if
Profile.MsgBox(aMessage)
end sub
function GetFileInfo(aFile)
Dim aInfo
aInfo = aFile.FileName & vbNewLine &_
" - Full Path: " & VbTab & aFile.FullPath & vbNewLine &_
" - File Date: " & VbTab & aFile.FileDate & vbNewLine &_
" - Modified By: " & VbTab & aFile.ModifiedBy & vbNewLine &_
" - Comment: " & VbTab & aFile.Comment & vbNewLine &_
" - Version Number: " & VbTab & aFile.VersionNumber & vbNewLine &_
" - Size: " & VbTab & VbTab & aFile.FileData.Size & vbNewLine
GetFileInfo = aInfo
end function
sub EnsureFolder(aStore, aFolderName)
Dim aFolder
on error resume next
set aFolder = aStore.GetFolder(aFolderName)
if Err.Number <> 0 Then
Err.Clear
set aFolder = aStore.CreateFolder(aFolderName)
Profile.MsgBox("The folder '" & aFolder.FullPath & "' was created")
end if
end sub