Condividi tramite


SPGlobalConfig.Properties property

NOTE: This API is now obsolete.

Obsolete. Gets global configuration settings that are used in the SharePoint Foundation deployment.

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

Syntax

'Declaration
<ObsoleteAttribute("Most of the functionality in this class is available in SPFarm or SPWebService.",  _
    False)> _
Public ReadOnly Property Properties As SPPropertyBag
    Get
'Usage
Dim instance As SPGlobalConfig
Dim value As SPPropertyBag

value = instance.Properties
[ObsoleteAttribute("Most of the functionality in this class is available in SPFarm or SPWebService.", 
    false)]
public SPPropertyBag Properties { get; }

Property value

Type: Microsoft.SharePoint.Utilities.SPPropertyBag
An SPPropertyBag object that contains the global configuration settings.

Examples

The following code example iterates through the collection of key-and-value pairs that are returned by the Properties property and displays each pair.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint.Administration and Microsoft.SharePoint.Utilities namespaces.

[Visual Basic]
Dim globAdmin As New SPGlobalAdmin()
Dim globConfig As SPGlobalConfig = globAdmin.Config

Dim propBag As SPPropertyBag = globConfig.Properties
Dim keys As System.Collections.ICollection = propBag.Keys

Dim key As Object

For Each key In  keys
    Response.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + SPEncode.HtmlEncode(propBag(key.ToString())) + "<BR>")
Next key
[C#]
SPGlobalAdmin globAdmin = new SPGlobalAdmin();
SPGlobalConfig globConfig = globAdmin.Config;

SPPropertyBag propBag = globConfig.Properties;
System.Collections.ICollection keys = propBag.Keys;

foreach (object key in keys)
{
    Response.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + SPEncode.HtmlEncode(propBag[key.ToString()]) + "<BR>");
}

See also

Reference

SPGlobalConfig class

SPGlobalConfig members

Microsoft.SharePoint.Administration namespace