Share via


SPListItem.Properties property

Gets metadata for the item.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public ReadOnly Property Properties As Hashtable
    Get
'Usage
Dim instance As SPListItem
Dim value As Hashtable

value = instance.Properties
public Hashtable Properties { get; }

Property value

Type: System.Collections.Hashtable
The metadata for the item.

Examples

The following example is a console application that gets the first item from the Shared Documents library in a Web site, accesses the Properties property, and iterates through the hash table, printing each key and corresponding value to the console.

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();
      }
   }
}

See also

Reference

SPListItem class

SPListItem members

Microsoft.SharePoint namespace