public static void NewFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store) { NewMailUserCmdlet newMailUserCmdlet = new NewMailUserCmdlet(); newMailUserCmdlet.Authenticator = PswsAuthenticator.Create(); newMailUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null); if (!string.IsNullOrEmpty(inputRow["FirstName"].ToString())) { newMailUserCmdlet.FirstName = inputRow["FirstName"].ToString(); } if (!string.IsNullOrEmpty(inputRow["Initials"].ToString())) { newMailUserCmdlet.Initials = inputRow["Initials"].ToString(); } if (!string.IsNullOrEmpty(inputRow["LastName"].ToString())) { newMailUserCmdlet.LastName = inputRow["LastName"].ToString(); } if (!string.IsNullOrEmpty(inputRow["ExternalEmailAddress"].ToString())) { newMailUserCmdlet.ExternalEmailAddress = inputRow["ExternalEmailAddress"].ToString(); } newMailUserCmdlet.Alias = inputRow["Alias"].ToString(); newMailUserCmdlet.DisplayName = inputRow["MailUserDisplayName"].ToString(); newMailUserCmdlet.Name = inputRow["MailUserDisplayName"].ToString(); newMailUserCmdlet.Password = inputRow["PlainPassword"].ToString(); newMailUserCmdlet.PrimarySmtpAddress = inputRow["PrimarySmtpAddress"].ToString(); newMailUserCmdlet.MicrosoftOnlineServicesID = inputRow["MicrosoftOnlineServicesID"].ToString(); newMailUserCmdlet.Run(); if (!string.IsNullOrEmpty(newMailUserCmdlet.Error)) { throw new Exception(newMailUserCmdlet.Error); } }
protected override void InternalProcessRecord() { try { NewMailUserCmdlet newMailUserCmdlet = new NewMailUserCmdlet(); ADObjectId executingUserId; base.ExchangeRunspaceConfig.TryGetExecutingUserId(out executingUserId); newMailUserCmdlet.Authenticator = Authenticator.Create(base.CurrentOrganizationId, executingUserId); newMailUserCmdlet.HostServerName = EOPRecipient.GetPsWsHostServerName(); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.FirstName, this.FirstName); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.Initials, this.Initials); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.LastName, this.LastName); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.ExternalEmailAddress, this.ExternalEmailAddress); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.Alias, this.Alias); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.PrimarySmtpAddress, this.PrimarySmtpAddress); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.Organization, base.Organization); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.MicrosoftOnlineServicesID, this.MicrosoftOnlineServicesID); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.DisplayName, this.DisplayName); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.Name, this.Name); EOPRecipient.SetProperty(newMailUserCmdlet, Parameters.Password, this.Password); newMailUserCmdlet.Run(); EOPRecipient.CheckForError(this, newMailUserCmdlet); } catch (Exception e) { base.ThrowAndLogTaskError(e); } }