SPSite.SecondaryContact 属性

Gets or sets the secondary contact that is used for the site collection. (Read-only in 沙盒解决方案.)

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

语法

声明
Public Property SecondaryContact As SPUser
    Get
    Set
用法
Dim instance As SPSite
Dim value As SPUser

value = instance.SecondaryContact

instance.SecondaryContact = value
public SPUser SecondaryContact { get; set; }

属性值

类型:Microsoft.SharePoint.SPUser
An SPUser object that represents the secondary contact.

备注

The user that is specified by the SecondaryContact property should not be identical to the user that is specified by the Owner property.

示例

The following code example sets a user as the secondary contact for a site collection.

Using oSiteCollection As New SPSite("http://" + System.Environment.MachineName)
    Using oWebsiteRoot As SPWeb = oSiteCollection.Current.Site.AllWebs(System.Environment.MachineName)
        oWebsite.SecondaryContact = oWebsiteRoot.RootWeb.Users("User_Name")
    End Using
End Using
using (SPSite oSiteCollection = new SPSite("http://" + System.Environment.MachineName))
{
    using (SPWeb oWebsiteRoot = oSiteCollection.Current.Site.AllWebs("http://" + System.Environment.MachineName))
    {
        oWebsite.SecondaryContact = oWebsiteRoot.RootWeb.Users["User_Name"];
    }
}

备注

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

另请参阅

引用

SPSite 类

SPSite 成员

Microsoft.SharePoint 命名空间