此主题中的一些内容不适用于某些语言。
返回 WebFiles 集合中的项目。只读,Object 类型。
Files 属性是指向 WebFiles 集合的指针。若要访问该集合,请声明 WebFiles 类型的变量,如下述语句所示:Dim myFiles As WebFiles
,然后将变量 myFiles
设置为 Web.RootFolder.Files
。
本示例获取文件的所有属性,并且将 META 标记连成一个字符串,用管道分隔符(“|”)分隔其中的数据。
注意 本示例所示的 PropertyKeys 应用于用“单页站点向导”创建的站点。其他模板可能使用其他 PropertyKeys。
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