Esempio n. 1
0
        public PowerShellResults JoinGroups(Identity[] identities)
        {
            identities.FaultIfNullOrEmpty();
            Identity          groupIdentityForTranslation = DistributionGroupServiceBase.GetGroupIdentityForTranslation(identities);
            PowerShellResults powerShellResults           = new PowerShellResults();
            int num  = 0;
            int num2 = -1;

            for (int i = 0; i < identities.Length; i++)
            {
                PSCommand         psCommand          = new PSCommand().AddCommand("Add-DistributionGroupMember").AddParameter("Identity", identities[i]);
                PowerShellResults powerShellResults2 = base.Invoke(psCommand, groupIdentityForTranslation, null);
                if (powerShellResults2.SucceededWithoutWarnings)
                {
                    num++;
                    if (num == 1)
                    {
                        num2 = i;
                    }
                }
                powerShellResults.MergeErrors(powerShellResults2);
            }
            if (num > 0)
            {
                string text = (num == 1) ? OwaOptionStrings.JoinDlSuccess(identities[num2].DisplayName) : ((num == identities.Length) ? OwaOptionStrings.JoinDlsSuccess(num) : OwaOptionStrings.JoinOtherDlsSuccess(num));
                powerShellResults.Informations = new string[]
                {
                    text
                };
            }
            return(powerShellResults);
        }
Esempio n. 2
0
        public PowerShellResults RemoveObjects(Identity[] identities, BaseWebServiceParameters parameters)
        {
            identities.FaultIfNullOrEmpty();
            Identity          groupIdentityForTranslation = DistributionGroupServiceBase.GetGroupIdentityForTranslation(identities);
            PowerShellResults powerShellResults           = new PowerShellResults();

            for (int i = 0; i < identities.Length; i++)
            {
                PSCommand         psCommand = new PSCommand().AddCommand("Remove-DistributionGroupMember").AddParameter("Identity", identities[i]);
                PowerShellResults results   = base.Invoke(psCommand, groupIdentityForTranslation, parameters);
                powerShellResults.MergeErrors(results);
            }
            return(powerShellResults);
        }