SPSite.SecondaryContact property
取得或設定用於網站集合的第二位連絡人。(唯讀在沙箱化解決方案中。)
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
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; }
Property value
Type: Microsoft.SharePoint.SPUser
SPUser 物件,表示第二位連絡人。
備註
SecondaryContact屬性所指定的使用者不應該等於Owner屬性所指定的使用者。
Examples
下列程式碼範例會將使用者設定為第二位連絡人,網站集合。
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"];
}
}
注意事項 |
---|
某些物件實作IDisposable介面,並且您必須避免之後不再需要保留這些物件在記憶體中。良好的程式碼撰寫方式的相關資訊,請參閱Disposing Objects。 |