This function returns the source folder by its index.
object.GetItem(aIndex)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISSourceFolders interface |
|
aIndex |
In, Required | int |
The index of the source folder |
Create new folders with the specified paths and display some information about the folder tree.
sub main
Dim aStore
Dim aMessage
set aStore = Profile.SourceStore
EnsureFolder aStore, "Examples"
EnsureFolder aStore, "Examples/Part1"
EnsureFolder aStore, "Examples/Part2"
aMessage = GetSubfoldersInfo(aStore, "", 0)
Profile.MsgBox(aMessage)
end sub
function GetSubfoldersInfo(aStore, aPath, aLevel)
Dim aFolders, aFolder
Dim i
Dim aInfo
set aFolders = aStore.GetFolders(aPath)
for i = 0 to aFolders.Count - 1
set aFolder = aFolders.GetItem(i)
aInfo = aInfo & vbNewLine & Space(aLevel * 4) & aFolder.FullPath &_
GetSubfoldersInfo(aStore, aFolder.FullPath, aLevel + 1)
next
GetSubfoldersInfo = 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