SPListItem.Properties 属性
获取项的元数据。
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public ReadOnly Property Properties As Hashtable
Get
用法
Dim instance As SPListItem
Dim value As Hashtable
value = instance.Properties
public Hashtable Properties { get; }
属性值
类型:System.Collections.Hashtable
项的元数据。
示例
下面的示例是一个控制台应用程序从网站中的共享文档库中获取的第一项,访问Properties属性中,并循环访问各个打印到控制台的每个密钥和相应值的哈希表。
Imports System
Imports System.Collections
Imports Microsoft.SharePoint
Module ConsoleApp
Sub Main()
Using site As SPSite = New SPSite("https://localhost")
Using web As SPWeb = site.OpenWeb()
Dim list As SPList = web.GetList("/shared documents/")
If list.ItemCount > 0 Then
Dim item As SPListItem = list.Items(0)
Dim ht As Hashtable = item.Properties
Dim de As DictionaryEntry
For Each de In ht
Console.WriteLine("Key: {0} Value: {1}", de.Key, de.Value)
Next
End If
End Using
End Using
Console.ReadLine()
End Sub
End Module
using System;
using Microsoft.SharePoint;
using System.Collections;
namespace Test
{
class ConsoleApp
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.GetList("/shared documents/");
if (list.ItemCount > 0)
{
SPListItem item = list.Items[0];
Hashtable ht = item.Properties;
foreach (DictionaryEntry de in ht)
Console.WriteLine("Key: {0} Value: {1}", de.Key, de.Value);
}
}
}
Console.ReadLine();
}
}
}