Exemple #1
0
 protected override void InternalProcessRecord()
 {
     try
     {
         SetDistributionGroupCmdlet setDistributionGroupCmdlet = new SetDistributionGroupCmdlet();
         ADObjectId executingUserId;
         base.ExchangeRunspaceConfig.TryGetExecutingUserId(out executingUserId);
         setDistributionGroupCmdlet.Authenticator  = Authenticator.Create(base.CurrentOrganizationId, executingUserId);
         setDistributionGroupCmdlet.HostServerName = EOPRecipient.GetPsWsHostServerName();
         if (string.IsNullOrEmpty(this.ExternalDirectoryObjectId) && this.Identity == null)
         {
             base.ThrowTaskError(new ArgumentException(CoreStrings.MissingIdentityParameter.ToString()));
         }
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.Identity, string.IsNullOrEmpty(this.ExternalDirectoryObjectId) ? this.Identity.ToString() : this.ExternalDirectoryObjectId);
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.DisplayName, this.DisplayName);
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.Alias, this.Alias);
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.PrimarySmtpAddress, this.PrimarySmtpAddress);
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.ManagedBy, this.ManagedBy);
         EOPRecipient.SetProperty(setDistributionGroupCmdlet, Parameters.Organization, base.Organization);
         setDistributionGroupCmdlet.Run();
         EOPRecipient.CheckForError(this, setDistributionGroupCmdlet);
     }
     catch (Exception e)
     {
         base.ThrowAndLogTaskError(e);
     }
 }
Exemple #2
0
 protected override void InternalProcessRecord()
 {
     try
     {
         NewDistributionGroupCmdlet newDistributionGroupCmdlet = new NewDistributionGroupCmdlet();
         ADObjectId executingUserId;
         base.ExchangeRunspaceConfig.TryGetExecutingUserId(out executingUserId);
         newDistributionGroupCmdlet.Authenticator  = Authenticator.Create(base.CurrentOrganizationId, executingUserId);
         newDistributionGroupCmdlet.HostServerName = EOPRecipient.GetPsWsHostServerName();
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Name, this.Name);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.DisplayName, this.DisplayName);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Alias, this.Alias);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.PrimarySmtpAddress, this.PrimarySmtpAddress);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Notes, this.Notes);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.ManagedByForInput, this.ManagedBy);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Members, this.Members);
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Type, this.Type.ToString());
         EOPRecipient.SetProperty(newDistributionGroupCmdlet, Parameters.Organization, base.Organization);
         newDistributionGroupCmdlet.Run();
         EOPRecipient.CheckForError(this, newDistributionGroupCmdlet);
     }
     catch (Exception e)
     {
         base.ThrowAndLogTaskError(e);
     }
 }
 public static void CheckForError(Task task, PswsCmdlet cmdlet)
 {
     ArgumentValidator.ThrowIfNull("task", task);
     ArgumentValidator.ThrowIfNull("cmdlet", cmdlet);
     if (!string.IsNullOrEmpty(cmdlet.Error))
     {
         string errMsg = cmdlet.Error.ToString();
         EOPRecipient.PublishErrorEvent(errMsg);
         string        text          = "<NULL>";
         Authenticator authenticator = cmdlet.Authenticator as Authenticator;
         if (authenticator != null)
         {
             text = text.ToString();
         }
         ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_FfoReportingRecipientTaskFailure, new string[]
         {
             cmdlet.Organization ?? "<NULL>",
             cmdlet.HostServerName ?? "<NULL>",
             cmdlet.ToString() ?? "<NULL>",
             cmdlet.AdditionalHeaders.ToString() ?? "<NULL>",
             (cmdlet.RequestTimeout != null) ? cmdlet.RequestTimeout.Value.ToString() : "<NULL>",
             cmdlet.Exception.ToString() ?? "<NULL>"
         });
         task.WriteError(cmdlet.Exception, ErrorCategory.InvalidOperation, null);
     }
 }
Exemple #4
0
 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);
     }
 }
Exemple #5
0
 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);
     }
 }