SPFolder.Properties property
取得包含資料夾的中繼資料的雜湊資料表。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public ReadOnly Property Properties As Hashtable
Get
'用途
Dim instance As SPFolder
Dim value As Hashtable
value = instance.Properties
public Hashtable Properties { get; }
Property value
Type: System.Collections.Hashtable
System.Collections.Hashtable物件,包含中繼資料。
備註
注意事項 |
---|
在這個屬性中儲存大量的資料會嚴重降低效能。不要在此屬性中儲存以上一個千位元組 (1 k) 的使用者資料。 |
Examples
下列程式碼範例會逐一查看集合中目前的網站上的資料夾,並顯示的屬性和值的每個資料夾。
這個範例要求using指示詞 (在 Visual Basic 的Imports ) 的Microsoft.SharePoint和Microsoft.SharePoint.Utilities命名空間。
SPWeb oWebsite = SPContext.Current.Web;
SPFolderCollection collFolders = oWebsite.Folders;
foreach (SPFolder oFolder in collFolders)
{
System.Collections.Hashtable oHashtable = oFolder.Properties;
System.Collections.ICollection collKeys = oHashtable.Keys;
foreach (object oKey in collKeys)
{
Response.Write(SPEncode.HtmlEncode(oKey.ToString()) + " :: " +
SPEncode.HtmlEncode(hashtable[oKey.ToString()]) + "<BR>");
}
}
Dim oWebsite As SPWeb = SPContext.Current.Web
Dim collFolders As SPFolderCollection = oWebsite.Folders
For Each oFolder As SPFolder In collFolders
Dim oHashtable As System.Collections.Hashtable = oFolder.Properties
Dim collKeys As System.Collections.ICollection = oHashtable.Keys
For Each oKey As Object In collKeys
Response.Write(SPEncode.HtmlEncode(oKey.ToString()) & " :: " & SPEncode.HtmlEncode(hashtable(oKey.ToString())) & "<BR>")
Next oKey
Next oFolder
前一個範例會顯示中繼資料,如下所示:
vti_dirlateststamp :: 8/30/2006 1:06:19 AM
vti_etag :: "{101141FF-9E99-4404-AE4D-561B981472E4},0"
vti_isexecutable :: false
vti_candeleteversion :: true
vti_docstoretype :: 1
vti_timecreated :: 8/21/2006 1:28:31 AM
vti_isbrowsable :: true
vti_hassubdirs :: true
vti_listname :: {B6C3C6F9-A256-4FA4-B6A2-97549D48E530}
vti_replid :: rid:{101141FF-9E99-4404-AE4D-561B981472E4}
vti_listenableversioning :: false
vti_listenableminorversions :: false
vti_listbasetype :: 1
vti_level :: 1
vti_rtag :: rt:101141FF-9E99-4404-AE4D-561B981472E4@00000000000
vti_timelastmodified :: 8/21/2006 1:28:41 AM
vti_listservertemplate :: 101
vti_listrequirecheckout :: false
vti_listenablemoderation :: false
vti_listtitle :: TestDocLib2
vti_isscriptable :: false