ISSourceStore.CreateFolder

Description

This function creates a new folder with the specified full path at the source store and returns it.

Syntax

object.CreateFolder(aPath)

Part Attribute Type Description
object Required
The object always implements the ISSourceStore interface
aPath In, Required
string
The full path of the folder being created

Return Value

ISSourceFolder

Returns the created source folder.

Example

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
Note:

Version information

Added in v7.8.0