Beispiel #1
0
        private bool CreateContact(int index, int orgId, string displayName, string emailAddress, string firstName, string middleName, string lastName,
                                   string address, string city, string state, string zip, string country, string jobTitle, string company, string department, string office,
                                   string businessPhone, string fax, string homePhone, string mobilePhone, string pager, string webPage, string notes)
        {
            bool ret = false;

            try
            {
                string name   = emailAddress.Substring(0, emailAddress.IndexOf("@"));
                string domain = emailAddress.Substring(emailAddress.IndexOf("@") + 1);

                //create contact
                int accountId = ES.Services.ExchangeServer.CreateContact(orgId, displayName, emailAddress);
                if (accountId < 0)
                {
                    string errorMessage = GetErrorMessage(accountId);
                    Log.WriteError(string.Format("Error at line {0}: {1}", index + 1, errorMessage));
                    return(false);
                }
                ExchangeContact contact = ES.Services.ExchangeServer.GetContactGeneralSettings(orgId, accountId);

                contact.FirstName     = firstName;
                contact.Initials      = middleName;
                contact.LastName      = lastName;
                contact.Address       = address;
                contact.City          = city;
                contact.State         = state;
                contact.Zip           = zip;
                contact.Country       = country;
                contact.JobTitle      = jobTitle;
                contact.Company       = company;
                contact.Department    = department;
                contact.Office        = office;
                contact.BusinessPhone = businessPhone;
                contact.Fax           = fax;
                contact.HomePhone     = homePhone;
                contact.MobilePhone   = mobilePhone;
                contact.Pager         = pager;
                contact.WebPage       = webPage;
                contact.Notes         = notes;

                //update mailbox
                ES.Services.ExchangeServer.SetContactGeneralSettings(orgId, accountId, contact.DisplayName, contact.EmailAddress,
                                                                     contact.HideFromAddressBook, contact.FirstName, contact.Initials,
                                                                     contact.LastName, contact.Address, contact.City, contact.State, contact.Zip, contact.Country,
                                                                     contact.JobTitle, contact.Company, contact.Department, contact.Office, null, contact.BusinessPhone,
                                                                     contact.Fax, contact.HomePhone, contact.MobilePhone, contact.Pager, contact.WebPage, contact.Notes, contact.UseMapiRichTextFormat);

                ret = true;
            }
            catch (Exception ex)
            {
                Log.WriteError(string.Format("Error at line {0}: Unable to create contact", index + 1), ex);
            }
            return(ret);
        }
 public ExchangeContact GetContactMailFlowSettings(string accountName)
 {
     try
     {
         LogStart("GetContactMailFlowSettings");
         ExchangeContact ret = ES.GetContactMailFlowSettings(accountName);
         LogEnd("GetContactMailFlowSettings");
         return(ret);
     }
     catch (Exception ex)
     {
         LogError("GetContactMailFlowSettings", ex);
         throw;
     }
 }
Beispiel #3
0
        private void BindSettings()
        {
            try
            {
                // get settings
                ExchangeContact contact = ES.Services.ExchangeServer.GetContactGeneralSettings(PanelRequest.ItemID,
                                                                                               PanelRequest.AccountID);

                litDisplayName.Text = PortalAntiXSS.Encode(contact.DisplayName);

                // bind form
                txtDisplayName.Text        = contact.DisplayName;
                txtEmail.Text              = contact.EmailAddress;
                chkHideAddressBook.Checked = contact.HideFromAddressBook;

                txtFirstName.Text = contact.FirstName;
                txtInitials.Text  = contact.Initials;
                txtLastName.Text  = contact.LastName;

                txtJobTitle.Text   = contact.JobTitle;
                txtCompany.Text    = contact.Company;
                txtDepartment.Text = contact.Department;
                txtOffice.Text     = contact.Office;
                manager.SetAccount(contact.ManagerAccount);

                txtBusinessPhone.Text = contact.BusinessPhone;
                txtFax.Text           = contact.Fax;
                txtHomePhone.Text     = contact.HomePhone;
                txtMobilePhone.Text   = contact.MobilePhone;
                txtPager.Text         = contact.Pager;
                txtWebPage.Text       = contact.WebPage;

                txtAddress.Text = contact.Address;
                txtCity.Text    = contact.City;
                txtState.Text   = contact.State;
                txtZip.Text     = contact.Zip;
                country.Country = contact.Country;
                txtNotes.Text   = contact.Notes;
                ddlMAPIRichTextFormat.SelectedValue = contact.UseMapiRichTextFormat.ToString();
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("EXCHANGE_GET_CONTACT_SETTINGS", ex);
            }
        }
Beispiel #4
0
        private void BindSettings()
        {
            try
            {
                // get settings
                ExchangeContact contact = ES.Services.ExchangeServer.GetContactMailFlowSettings(
                    PanelRequest.ItemID, PanelRequest.AccountID);

                litDisplayName.Text = contact.DisplayName;

                // bind form
                acceptAccounts.SetAccounts(contact.AcceptAccounts);
                chkSendersAuthenticated.Checked = contact.RequireSenderAuthentication;
                rejectAccounts.SetAccounts(contact.RejectAccounts);
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("EXCHANGE_GET_CONTACT_MAILFLOW", ex);
            }
        }