Share via


Files Property

Some of the content in this topic may not be applicable to some languages.

Returns a WebFiles collection that represents the items in the specified Web folder. Read-only object.

expression.Files

*expression   * Required. An expression that returns a WebFolder object.

Remarks

The Files property is an accessor property used to access the WebFiles collection. To access the collection, declare a variable of type WebFiles as shown in the statement Dim myFiles As WebFiles, and then set the variable myFiles to Web.RootFolder.Files.

Example

The following example retrieves all of the properties of a file and concatenates the META tags into a string with a pipe ("|") delimiter separating the data.

Note  The PropertyKeys shown in this example apply to a Web site created with the One Page Web Site template. Other templates may use other PropertyKeys. For more information about using PropertyKeys, see the Properties collection.

Private Sub GetFileProperties()
    Dim myFiles As WebFiles
    Dim myFile As WebFile
    Dim myAuthor As String
    Dim myModifiedBy As String
    Dim myTimeCreated As String
    Dim myTimeLastModified As String
    Dim myFileSize As String
    Dim myTitle As String
    Dim myMetaTags As Variant
    Dim myMetaTag As Variant
    Dim myProgID As Variant
    Dim myGenerator As String
    Dim myTimeLastWritten As String
    Dim myProperties As Properties
    Dim myMetaTagList As String

    Set myFiles = ActiveWeb.RootFolder.Files

    For Each myFile In myFiles
        Set myProperties = myFile.Properties
        myAuthor = myAuthor & myProperties("vti_author")
        myModifiedBy = myModifiedBy & _
            myProperties("vti_modifiedby) & "|"
        myTimeCreated = myTimeCreated & _
            myProperties("vti_timecreated") & "|"
        myTimeLastModified = myTimeLastModified & _
            myProperties("vti_timelastmodified") & "|"
        myFileSize = myFileSize & _
            myProperties("vti_FileSize) & "|"
        myTitle = myTitle & myProperties("vti_title") & "|"
        myProgID = myProgID & myProperties("vti_title") & "|"
        myGenerator = myGenerator & _
            myProperties("vti_generator") & "|"
        myTimeLastWritten = myTimeLastWritten & _
            myProperties("vti_timelastwritten") & "|"
        myMetaTags = myProperties("vti_metatags")
        For Each myMetaTag In myMetaTags
            myMetaTagList = myMetaTagList & myMetaTag & "|"
        Next
    Next
End Sub

Applies to | WebFolder Object