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