SPSite.SecondaryContact Property

Gets or sets the secondary contact that is used for the site collection. (Read-only in sandboxed solutions.)

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Property SecondaryContact As SPUser
    Get
    Set
'Usage
Dim instance As SPSite
Dim value As SPUser

value = instance.SecondaryContact

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

Property Value

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

Remarks

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

Examples

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"];
    }
}

Note

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.

See Also

Reference

SPSite Class

SPSite Members

Microsoft.SharePoint Namespace