Platform SDK: Team Productivity Update

Copying Files into the Physical Directory

The Deploy URL for the Expense Report application names paths for the physical directory, virtual directory, and database as the last step in Creating the Expense Report Application Physical Directory. Next, it creates the directory for the instance of the application requested by the Team Workspace and copies the application's files into it.

The code begins by passing the WebPath variable that holds the application's Web physical directory name to the FileSystemObject object. This creates the directory for the Expense Report application instance for the Team Workspace that requested it.

' Create instance directory (and its sub-directories) and copy files over
Set oFolder = oFileSystem.CreateFolder(WebPath) ' Root 

After the script has created the root folder, it calls the CopyFile method of the FileSystemObject object (part of the ASP File Access component). The script passes in the paths and file names for the files that will be copied into the root directory of the application's Web directory.

' Create instance directory (and it's sub-directories) and copy files over
Set oFolder = oFileSystem.CreateFolder(WebPath) ' Root
Call oFileSystem.CopyFile(SourcePath & "\Approval.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\approveReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\Calculator.inc", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\checkStatus.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\Common.inc", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\dbapi.vb", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\Default.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\default.htm", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\global.asa", WebPath & "\")  
Call oFileSystem.CopyFile(SourcePath & "\makeReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\resubmitReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\Style.inc", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\submitApproval.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\submitReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\summary.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\viewApprovedReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\viewDeniedReport.asp", WebPath & "\") 
Call oFileSystem.CopyFile(SourcePath & "\viewPendingReport.asp", WebPath & "\")

Next, the script names and creates a subfolder for the image files needed for the application and also its database.

The following code creates the Images subfolder and copies its contents from the source directory to the Team Workspace:

    SubFolderPath = oFileSystem.BuildPath(WebPath, "\images")  ' Images
    Set oFolder = oFileSystem.CreateFolder(SubFolderPath)
    Call oFileSystem.CopyFile(SourcePath & "\images\*.gif", SubFolderPath & "\")

The following code creates the folder that will hold the SQL Server database the application uses. Finally, after creating all the physical directories and files at the designated location, the oFolder object is set to Nothing, and the memory is freed.

    Set oFolder = oFileSystem.CreateFolder(DataPath)  ' Database
    Set oFile = oFileSystem.OpenTextFile(SourcePath & "\expense.sql", 1) ' Read
    SQLText = oFile.ReadAll  ' Used below
    oFile.Close
    Set oFile = Nothing
    Set oFolder = Nothing

To follow the next steps in the script's execution, see Updating the Global.asa File.