protected override void InternalProcessRecord() { try { SetUserCmdlet setUserCmdlet = new SetUserCmdlet(); ADObjectId executingUserId; base.ExchangeRunspaceConfig.TryGetExecutingUserId(out executingUserId); setUserCmdlet.Authenticator = Authenticator.Create(base.CurrentOrganizationId, executingUserId); setUserCmdlet.HostServerName = EOPRecipient.GetPsWsHostServerName(); if (string.IsNullOrEmpty(this.ExternalDirectoryObjectId) && this.Identity == null) { base.ThrowTaskError(new ArgumentException(CoreStrings.MissingIdentityParameter.ToString())); } EOPRecipient.SetProperty(setUserCmdlet, Parameters.Identity, string.IsNullOrEmpty(this.ExternalDirectoryObjectId) ? this.Identity.ToString() : this.ExternalDirectoryObjectId); EOPRecipient.SetProperty(setUserCmdlet, Parameters.DisplayName, this.DisplayName); EOPRecipient.SetProperty(setUserCmdlet, Parameters.FirstName, this.FirstName); EOPRecipient.SetProperty(setUserCmdlet, Parameters.LastName, this.LastName); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Initials, this.Initials); EOPRecipient.SetProperty(setUserCmdlet, Parameters.City, this.City); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Office, this.Office); EOPRecipient.SetProperty(setUserCmdlet, Parameters.StateOrProvince, this.StateOrProvince); EOPRecipient.SetProperty(setUserCmdlet, Parameters.PostalCode, this.PostalCode); EOPRecipient.SetProperty(setUserCmdlet, Parameters.CountryOrRegion, this.CountryOrRegion); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Phone, this.Phone); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Notes, this.Notes); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Title, this.Title); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Department, this.Department); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Company, this.Company); EOPRecipient.SetProperty(setUserCmdlet, Parameters.StreetAddress, this.StreetAddress); EOPRecipient.SetProperty(setUserCmdlet, Parameters.MobilePhone, this.MobilePhone); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Fax, this.Fax); EOPRecipient.SetProperty(setUserCmdlet, Parameters.HomePhone, this.HomePhone); EOPRecipient.SetProperty(setUserCmdlet, Parameters.WebPage, this.WebPage); EOPRecipient.SetProperty(setUserCmdlet, Parameters.Organization, base.Organization); setUserCmdlet.Run(); EOPRecipient.CheckForError(this, setUserCmdlet); } catch (Exception e) { base.ThrowAndLogTaskError(e); } }
public static void SetFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store) { SetUserCmdlet setUserCmdlet = new SetUserCmdlet(); setUserCmdlet.Authenticator = PswsAuthenticator.Create(); setUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null); setUserCmdlet.Identity = ((Identity)inputRow["Identity"]).RawIdentity; if (!DBNull.Value.Equals(inputRow["DisplayName"])) { setUserCmdlet.DisplayName = inputRow["DisplayName"].ToString(); } if (!DBNull.Value.Equals(inputRow["FirstName"])) { setUserCmdlet.FirstName = inputRow["FirstName"].ToString(); } if (!DBNull.Value.Equals(inputRow["LastName"])) { setUserCmdlet.LastName = inputRow["LastName"].ToString(); } if (!DBNull.Value.Equals(inputRow["Initials"])) { setUserCmdlet.Initials = inputRow["Initials"].ToString(); } if (!DBNull.Value.Equals(inputRow["City"])) { setUserCmdlet.City = inputRow["City"].ToString(); } if (!DBNull.Value.Equals(inputRow["Office"])) { setUserCmdlet.Office = inputRow["Office"].ToString(); } if (!DBNull.Value.Equals(inputRow["StateOrProvince"])) { setUserCmdlet.StateOrProvince = inputRow["StateOrProvince"].ToString(); } if (!DBNull.Value.Equals(inputRow["PostalCode"])) { setUserCmdlet.PostalCode = inputRow["PostalCode"].ToString(); } if (!DBNull.Value.Equals(inputRow["CountryOrRegion"])) { setUserCmdlet.CountryOrRegion = inputRow["CountryOrRegion"].ToString(); } if (!DBNull.Value.Equals(inputRow["Phone"])) { setUserCmdlet.Phone = inputRow["Phone"].ToString(); } if (!DBNull.Value.Equals(inputRow["Notes"])) { setUserCmdlet.Notes = inputRow["Notes"].ToString(); } if (!DBNull.Value.Equals(inputRow["Title"])) { setUserCmdlet.Title = inputRow["Title"].ToString(); } if (!DBNull.Value.Equals(inputRow["Department"])) { setUserCmdlet.Department = inputRow["Department"].ToString(); } if (!DBNull.Value.Equals(inputRow["Company"])) { setUserCmdlet.Company = inputRow["Company"].ToString(); } if (!DBNull.Value.Equals(inputRow["StreetAddress"])) { setUserCmdlet.StreetAddress = inputRow["StreetAddress"].ToString(); } if (!DBNull.Value.Equals(inputRow["MobilePhone"])) { setUserCmdlet.MobilePhone = inputRow["MobilePhone"].ToString(); } if (!DBNull.Value.Equals(inputRow["Fax"])) { setUserCmdlet.Fax = inputRow["Fax"].ToString(); } if (!DBNull.Value.Equals(inputRow["HomePhone"])) { setUserCmdlet.HomePhone = inputRow["HomePhone"].ToString(); } if (!DBNull.Value.Equals(inputRow["WebPage"])) { setUserCmdlet.WebPage = inputRow["WebPage"].ToString(); } setUserCmdlet.Run(); if (!string.IsNullOrEmpty(setUserCmdlet.Error)) { throw new Exception(setUserCmdlet.Error); } }