SPWeb.Properties 属性

Gets a SPPropertyBag object with the metadata for the website.

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public ReadOnly Property Properties As SPPropertyBag
    Get
用法
Dim instance As SPWeb
Dim value As SPPropertyBag

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

属性值

类型:Microsoft.SharePoint.Utilities.SPPropertyBag
An SPPropertyBag object that contains the properties settings.

备注

This property returns only a subset of the metadata for a website. To get all the metadata, use the AllProperties property.

示例

The following example is a console application that accesses the Properties property, iterates through the collection, and prints each key/value pair to the console.

using System;
using System.Collections;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPPropertyBag props = web.Properties;
                    foreach (DictionaryEntry de in props)
                    {
                        Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
                    }
                }
            }
            Console.ReadLine();
        }
    }
}
Imports System
Imports System.Collections
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities

Namespace Test
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            Using site As New SPSite("https://localhost")
                Using web As SPWeb = site.OpenWeb()
                    Dim props As SPPropertyBag = web.Properties
                    For Each de As DictionaryEntry In props
                        Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value)
                    Next de
                End Using
            End Using
            Console.ReadLine()
        End Sub
    End Class
End Namespace

The output that this application prints to the console varies with the website, but it might look like the following:

Key = vti_associatemembergroup, Value = 5
Key = vti_extenderversion, Value = 14.0.0.4016
Key = vti_associatevisitorgroup, Value = 4
Key = vti_associategroups, Value = 5;4;3
Key = vti_createdassociategroups, Value = 3;4;5
Key = vti_siteusagetotalbandwidth, Value = 547
Key = vti_siteusagetotalvisits, Value = 9
Key = vti_associateownergroup, Value = 3
Key = vti_defaultlanguage, Value = en-us

另请参阅

引用

SPWeb 类

SPWeb 成员

Microsoft.SharePoint 命名空间