SPUser.Email property
取得或設定使用者的電子郵件地址。(唯讀在沙箱化解決方案中。)
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Property Email As String
Get
Set
'用途
Dim instance As SPUser
Dim value As String
value = instance.Email
instance.Email = value
public string Email { get; set; }
Property value
Type: System.String
字串,包含電子郵件地址。
備註
若要修改使用者的電子郵件地址,藉由設定Email屬性的值,呼叫Update方法來影響資料庫中的變更。
Examples
下列程式碼範例會修改指定的使用者物件的電子郵件地址。
Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim site As SPWeb = siteColl.AllWebs("Site_Name")
Dim user As SPUser = site.AllUsers("User_Name")
user.Email = "E-mail_Address"
user.Update()
SPSite oSiteCollection = SPContext.Current.Site;
using (SPWeb oWebsite = oSiteCollection.AllWebs["Website_Name"])
{
SPUser oUser = oWebsite.AllUsers["User_Name"];
oUser.Email = " E-mail_Address";
oUser.Update();
}
注意事項 |
---|
某些物件實作IDisposable介面,並且您必須避免之後不再需要保留這些物件在記憶體中。良好的程式碼撰寫方式的相關資訊,請參閱Disposing Objects。 |