SPVirtualServerConfig.Properties 属性
请注意:此 API 现在已过时。
获取用于在虚拟服务器的配置设置。
命名空间: Microsoft.SharePoint.Administration
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.", _
False)> _
Public ReadOnly Property Properties As SPPropertyBag
Get
用法
Dim instance As SPVirtualServerConfig
Dim value As SPPropertyBag
value = instance.Properties
[ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.",
false)]
public SPPropertyBag Properties { get; }
属性值
类型:Microsoft.SharePoint.Utilities.SPPropertyBag
Microsoft.SharePoint.Utilities.SPPropertyBag 对象,该对象包含虚拟服务器的配置设置。有关字符串键表示属性包中的信息,请参阅管理员指南 》 SharePoint Foundation中的"命令行属性"。
示例
下面的代码示例循环访问由Properties属性返回的键 / 值对的集合,并显示每一对。该示例要求using指令 (在 Visual Basic 中的Imports ) 的Microsoft.SharePoint.Administration和Microsoft.SharePoint.Utilities的命名空间。
Dim globAdmin As New SPGlobalAdmin()
Dim vServer As SPVirtualServer = globAdmin.VirtualServers(0)
Dim propBag As SPPropertyBag = vServer.Config.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
SPGlobalAdmin globAdmin = new SPGlobalAdmin();
SPVirtualServer vServer = globAdmin.VirtualServers[0];
SPPropertyBag propBag = vServer.Config.Properties;
System.Collections.ICollection keys = propBag.Keys;
foreach (object key in keys)
{
Response.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + SPEncode.HtmlEncode(propBag[key.ToString()]) + "<BR>");
}
下面的示例使用Properties 属性,以启用安全验证和到期日期,以及要将安全验证的超时值设置为 40 分钟。
Dim globalAdmin As New SPGlobalAdmin()
Dim vServer As SPVirtualServer = globalAdmin.OpenVirtualServer(New Uri("http://Virtual_Server"))
vServer.Config.Properties("securityvalidation-enabled") = Boolean.TrueString
vServer.Config.Properties("securityvalidation-expire") = Boolean.TrueString
vServer.Config.Properties("securityvalidation-timeout") = "40"
vServer.Config.Properties.Update()
globalAdmin.Close()
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPVirtualServer vServer = globalAdmin.OpenVirtualServer(new Uri("http://Virtual_Server"));
vServer.Config.Properties["securityvalidation-enabled"] = bool.TrueString;
vServer.Config.Properties["securityvalidation-expire"] = bool.TrueString;
vServer.Config.Properties["securityvalidation-timeout"] = "40";
vServer.Config.Properties.Update();
globalAdmin.Close();