Share via


HostedEmailManager.UpdateAccount Method (String, EmailAccountInfo)

 

Synchronous call to update an email account.

Namespace:   Microsoft.WindowsServerSolutions.HostedEmail
Assembly:  Wssg.HostedEmailObjectModel (in Wssg.HostedEmailObjectModel.dll)

Syntax

public void UpdateAccount(
    string wssUserName,
    EmailAccountInfo accountInfo
)
public:
void UpdateAccount(
    String^ wssUserName,
    EmailAccountInfo^ accountInfo
)
Public Sub UpdateAccount (
    wssUserName As String,
    accountInfo As EmailAccountInfo
)

Parameters

Remarks

HostedEmailAccountUpdated is raised if the account is deleted successfully.

Examples

The following code uses UpdateAccount to update an email account. . For the complete code sample, see Quickstart: Creating a Hosted Email Adapter.

private void buttonOK_Click(object sender, EventArgs e)
        {
            if (null != EmailAccountInfo.ExtendedProperties)
            {
                EmailAccountInfo.ExtendedProperties[KeyForwardEmail] = this.textBoxEmail.Text;
                EmailAccountInfo.ExtendedProperties[KeyActiveSync] = this.checkBoxActiveSync.Checked.ToString();
            }

            bool err = false;

            using (ManualResetEvent done = new ManualResetEvent(false))
            {
                ThreadPool.QueueUserWorkItem((state) =>
                {
                    if (!manager.Connected)
                    {
                        if (!manager.Connect())
                        {
                            err = true;
                            done.Set();
                            return;
                        }
                    }

                    try
                    {
                        manager.UpdateAccount(UserName, EmailAccountInfo);
                    }
                    catch (Exception)
                    {
                        err = true;
                    }

                    done.Set();
                });
                done.WaitOne();
            }

            if (err) popupErrorMsg();
        }

See Also

HostedEmailManager Class
Microsoft.WindowsServerSolutions.HostedEmail Namespace

Return to top