public PowerShellResults <GetVoiceMailConfiguration> SetObject(Identity identity, SetVoiceMailConfiguration properties) { properties.FaultIfNull(); identity = Identity.FromExecutingUserId(); PowerShellResults <GetVoiceMailConfiguration> powerShellResults = new PowerShellResults <GetVoiceMailConfiguration>(); PowerShellResults <GetVoiceMailConfiguration> @object = this.GetObject(identity); powerShellResults.MergeErrors <GetVoiceMailConfiguration>(@object); if (powerShellResults.Failed) { return(powerShellResults); } powerShellResults.MergeErrors <UMMailboxPin>(base.SetObject <UMMailboxPin, SetVoiceMailPIN>("Set-UMMailboxPIN", identity, properties.SetVoiceMailPIN)); if (powerShellResults.Failed) { return(powerShellResults); } properties.ReturnObjectType = ReturnObjectTypes.Full; powerShellResults.MergeAll(base.SetObject <GetVoiceMailConfiguration, SetVoiceMailConfiguration>("Set-UMMailbox", identity, properties)); if (powerShellResults.SucceededWithValue) { GetVoiceMailConfiguration value = powerShellResults.Value; RbacPrincipal.Current.RbacConfiguration.ExecutingUserIsUmConfigured = value.IsConfigured; if (this.IsPhoneVerified(value.PhoneNumber, value) && !string.IsNullOrEmpty(properties.PhoneProviderId)) { PowerShellResults <SmsOptions> results = this.SetTextMessagingAccount(identity, value.PhoneNumber, value.PhoneProviderId, value); powerShellResults.MergeErrors <SmsOptions>(results); } } return(powerShellResults); }
private PowerShellResults <AdminRoleGroupRow> SetRoleAssignments(IEnumerable <Identity> unchangedRoles, ManagementRoleAssignments roleAssignmentsWebService, Identity identity, ManagementScopeRow scopeRow, ExtendedOrganizationalUnit ouRow, PowerShellResults <AdminRoleGroupRow> results) { if ((ouRow != null || scopeRow != null) && unchangedRoles != null) { foreach (Identity roleIdentity in unchangedRoles) { PowerShellResults <ManagementRoleAssignment> roleAssignments = this.GetRoleAssignments(roleIdentity, identity, roleAssignmentsWebService); if (roleAssignments.Failed) { results.MergeErrors <ManagementRoleAssignment>(roleAssignments); return(results); } SetManagementRoleAssignment properties = this.SetScopeInfoInParameter(roleIdentity, null, scopeRow, ouRow, results); if (results.Failed) { return(results); } ManagementRoleAssignment[] output = roleAssignments.Output; foreach (ManagementRoleAssignment managementRoleAssignment in output) { if (managementRoleAssignment.DelegationType == RoleAssignmentDelegationType.Regular) { results.MergeErrors <ManagementRoleAssignment>(roleAssignmentsWebService.SetObject(managementRoleAssignment.Identity, properties)); if (results.Failed) { return(results); } } } } return(results); } return(results); }
private PowerShellResults <AdminRoleGroupRow> RemoveRoleAssignments(IEnumerable <Identity> removedRoles, ManagementRoleAssignments roleAssignmentsWebService, Identity identity, PowerShellResults <AdminRoleGroupRow> results) { if (removedRoles != null) { foreach (Identity roleIdentity in removedRoles) { PowerShellResults <ManagementRoleAssignment> roleAssignments = this.GetRoleAssignments(roleIdentity, identity, roleAssignmentsWebService); if (roleAssignments.Failed) { results.MergeErrors <ManagementRoleAssignment>(roleAssignments); return(results); } if (roleAssignments != null && roleAssignments.Output != null) { ManagementRoleAssignment[] output = roleAssignments.Output; IEnumerable <Identity> source = from entry in output where entry.DelegationType == RoleAssignmentDelegationType.Regular select entry.Identity; results.MergeErrors(roleAssignmentsWebService.RemoveObjects(source.ToArray <Identity>(), null)); if (results.Failed) { return(results); } } } return(results); } return(results); }
public PowerShellResults BlockDevice(Identity[] identities, BaseWebServiceParameters parameters) { PowerShellResults powerShellResults = new PowerShellResults(); foreach (Identity identity in identities) { PowerShellResults <MobileDevice> @object = base.GetObject <MobileDevice>("Get-MobileDevice", identity); powerShellResults.MergeErrors <MobileDevice>(@object); if (@object.HasValue) { MobileDevice value = @object.Value; Identity identity2 = value.Id.Parent.Parent.ToIdentity(); PowerShellResults <CASMailbox> object2 = base.GetObject <CASMailbox>("Get-CASMailbox", identity2); powerShellResults.MergeErrors <CASMailbox>(object2); if (object2.HasValue) { MultiValuedProperty <string> activeSyncBlockedDeviceIDs = object2.Value.ActiveSyncBlockedDeviceIDs; if (!activeSyncBlockedDeviceIDs.Contains(value.DeviceId)) { activeSyncBlockedDeviceIDs.Add(value.DeviceId); PSCommand psCommand = new PSCommand().AddCommand("Set-CASMailbox").AddParameter("Identity", identity2).AddParameter("ActiveSyncBlockedDeviceIDs", activeSyncBlockedDeviceIDs); powerShellResults.MergeErrors(base.Invoke(psCommand)); } } } } return(powerShellResults); }
protected PowerShellResults <T> GetDistributionGroup <T>(Identity identity) where T : DistributionGroup { PowerShellResults <T> @object = base.GetObject <T>("Get-DistributionGroup", identity); if (@object.SucceededWithValue) { PowerShellResults <WindowsGroup> powerShellResults = @object.MergeErrors <WindowsGroup>(base.GetObject <WindowsGroup>("Get-Group", identity)); if (powerShellResults.SucceededWithValue) { T value = @object.Value; value.WindowsGroup = powerShellResults.Value; } if (RbacPrincipal.Current.IsInRole("Enterprise+Get-ADPermission?Identity")) { PowerShellResults <ADAcePresentationObject> powerShellResults2 = @object.MergeErrors <ADAcePresentationObject>(base.GetObject <ADAcePresentationObject>(new PSCommand().AddCommand("Get-ADPermission").AddParameter("Identity", identity))); if (powerShellResults2.Output.Length > 0) { T value2 = @object.Value; value2.SendAsPermissionsEnterprise = MailboxPropertiesHelper.FindRecipientsWithSendAsPermissionEnt(powerShellResults2.Output, null); } } else if (RbacPrincipal.Current.IsInRole("MultiTenant+Get-RecipientPermission?Identity")) { PowerShellResults <RecipientPermission> powerShellResults3 = @object.MergeErrors <RecipientPermission>(base.GetObject <RecipientPermission>(new PSCommand().AddCommand("Get-RecipientPermission").AddParameter("Identity", identity))); if (powerShellResults3.Output.Length > 0) { T value3 = @object.Value; value3.SendAsPermissionsCloud = MailboxPropertiesHelper.FindRecipientsWithSendAsPermissionCloud(powerShellResults3.Output); } } } return(@object); }
public PowerShellResults <Account> GetObject(Identity identity) { bool flag = identity != null; identity = (identity ?? Identity.FromExecutingUserId()); PowerShellResults <Account> @object = base.GetObject <Account>("Get-Mailbox", identity); if (@object.SucceededWithValue) { @object.Value.IsProfilePage = this.IsProfilePage; PowerShellResults <User> powerShellResults = @object.MergeErrors <User>(base.GetObject <User>("Get-User", identity)); if (powerShellResults.SucceededWithValue) { @object.Value.OrgPersonObject = powerShellResults.Value; if (RbacPrincipal.Current.IsInRole("MultiTenant+Mailbox+Get-MailboxStatistics?Identity@R:Organization") || (this.IsProfilePage && RbacPrincipal.Current.IsInRole("Mailbox+Get-MailboxStatistics?Identity@R:Self"))) { PowerShellResults <MailboxStatistics> object2 = base.GetObject <MailboxStatistics>("Get-MailboxStatistics", identity, false); if (object2.SucceededWithValue) { @object.Value.Statistics = object2.Value; } } if (@object.Value.IsRoom && RbacPrincipal.Current.IsInRole("Get-CalendarProcessing?Identity@R:Organization")) { PowerShellResults <CalendarConfiguration> powerShellResults2 = @object.MergeErrors <CalendarConfiguration>(base.GetObject <CalendarConfiguration>("Get-CalendarProcessing", identity, false)); if (powerShellResults2.SucceededWithValue) { @object.Value.CalendarConfiguration = powerShellResults2.Value; } } if (RbacPrincipal.Current.IsInRole("Get-SupervisionListEntry?Identity@R:Organization")) { SupervisionListEntryFilter filter = new SupervisionListEntryFilter { Identity = identity, Tag = null }; PowerShellResults <SupervisionListEntryRow> powerShellResults3 = @object.MergeErrors <SupervisionListEntryRow>(base.GetList <SupervisionListEntryRow, SupervisionListEntryFilter>("Get-SupervisionListEntry", filter, null)); if (powerShellResults3.Succeeded) { @object.Value.AllowedSenders = this.GetStringsWithTag(powerShellResults3.Output, "allow"); @object.Value.BlockedSenders = this.GetStringsWithTag(powerShellResults3.Output, "reject"); } } } if (RbacPrincipal.Current.IsInRole("Get-CasMailbox?Identity@R:Organization") || (!flag && RbacPrincipal.Current.IsInRole("Get-CasMailbox?Identity@R:Self"))) { PowerShellResults <CASMailbox> powerShellResults4 = @object.MergeErrors <CASMailbox>(base.GetObject <CASMailbox>("Get-CasMailbox", identity, false)); if (powerShellResults4.SucceededWithValue) { @object.Value.CasMailbox = powerShellResults4.Value; } } } return(@object); }
public PowerShellResults <SmsOptions> SetObject(Identity identity, SetSmsOptions properties) { properties.FaultIfNull(); identity = Identity.FromExecutingUserId(); if (!string.IsNullOrEmpty(properties.VerificationCode)) { PSCommand pscommand = new PSCommand(); pscommand.AddCommand("Compare-TextMessagingVerificationCode"); pscommand.AddParameter("VerificationCode", properties.VerificationCode); PowerShellResults results = base.Invoke(pscommand, new Identity[] { identity }, new BaseWebServiceParameters { ShouldContinue = properties.ShouldContinue }); PowerShellResults <SmsOptions> @object = this.GetObject(identity); @object.MergeErrors(results); return(@object); } if (!string.IsNullOrEmpty(properties.CountryCode) && !string.IsNullOrEmpty(properties.NotificationPhoneNumber) && !properties.NotificationPhoneNumber.StartsWith(properties.CountryCode)) { properties.NotificationPhoneNumber = properties.CountryCode + properties.NotificationPhoneNumber; } return(base.SetObject <SmsOptions, SetSmsOptions>("Set-TextMessagingAccount", identity, properties)); }
protected PowerShellResults <L> SetObject <O, U, L>(string setCmdlet, Identity identity, U properties, Identity identityForGetCmdlet) where O : L where U : SetObjectProperties { EcpPerfCounters.WebServiceSetObject.Increment(); identity.FaultIfNull(); properties.FaultIfNull(); PowerShellResults <L> powerShellResults = new PowerShellResults <L>(); properties.IgnoreNullOrEmpty = false; if (properties.Any <KeyValuePair <string, object> >()) { powerShellResults = this.CoreInvoke <L>(new PSCommand().AddCommand(setCmdlet), identity.ToPipelineInput(), identity, properties); } if (powerShellResults.Succeeded && null != identityForGetCmdlet) { PowerShellResults <L> powerShellResults2 = null; if (properties.ReturnObjectType == ReturnObjectTypes.Full && this is IGetObjectService <O> ) { IGetObjectService <O> getObjectService = this as IGetObjectService <O>; PowerShellResults <O> @object = getObjectService.GetObject(identityForGetCmdlet); powerShellResults2 = new PowerShellResults <L>(); powerShellResults2.MergeOutput(@object.Output.Cast <L>().ToArray <L>()); powerShellResults2.MergeErrors <O>(@object); } else if (properties.ReturnObjectType == ReturnObjectTypes.PartialForList && this is IGetObjectForListService <L> ) { IGetObjectForListService <L> getObjectForListService = this as IGetObjectForListService <L>; powerShellResults2 = getObjectForListService.GetObjectForList(identityForGetCmdlet); } if (powerShellResults2 != null) { powerShellResults.MergeAll(powerShellResults2); } } return(powerShellResults); }
private static PowerShellResults <T> GetProgressImpl <T>(string progressId, out AsyncServiceManager.WorkItem workItem) { PowerShellResults <T> powerShellResults = new PowerShellResults <T>(); workItem = null; if (!string.IsNullOrEmpty(progressId) && AsyncServiceManager.workItems.TryGetValue(progressId, out workItem)) { lock (workItem) { if (workItem.Results != null) { PowerShellResults <T> powerShellResults2 = workItem.Results as PowerShellResults <T>; if (powerShellResults2 != null) { powerShellResults = powerShellResults2; } else { powerShellResults.MergeErrors(workItem.Results); } AsyncServiceManager.workItems.Remove(progressId); workItem.FinishedEvent.Close(); } else { ProgressRecord progressRecord = null; if (workItem.LegacyProgressRecord != null) { progressRecord = workItem.LegacyProgressRecord; } else { ProgressRecord progressRecord2 = (workItem.ProgressCalculator == null) ? new ProgressRecord() : workItem.ProgressCalculator.ProgressRecord; lock (progressRecord2.SyncRoot) { progressRecord = new ProgressRecord { Errors = progressRecord2.Errors, FailedCount = progressRecord2.FailedCount, MaxCount = progressRecord2.MaxCount, Percent = progressRecord2.Percent, Status = progressRecord2.Status, SucceededCount = progressRecord2.SucceededCount, HasCompleted = progressRecord2.HasCompleted, IsCancelled = progressRecord2.IsCancelled }; progressRecord2.Errors = null; } } powerShellResults.ProgressRecord = progressRecord; } } } DDIHelper.Trace("GetProgress: {0}, Results: {1}", new object[] { progressId, powerShellResults }); return(powerShellResults); }
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); }
public PowerShellResults <NewUMMailboxConfiguration> GetConfigurationForNewUMMailbox(Identity identity, UMEnableSelectedPolicyParameters properties) { properties.FaultIfNull(); PSCommand pscommand = new PSCommand().AddCommand("Enable-UMMailbox"); pscommand.AddParameter("Identity", identity); pscommand.AddParameter("ValidateOnly"); if (properties.UMMailboxPolicy != null) { pscommand.AddParameter("UMMailboxPolicy", properties.UMMailboxPolicy); } PowerShellResults <NewUMMailboxConfiguration> powerShellResults = base.Invoke <NewUMMailboxConfiguration>(pscommand); if (!powerShellResults.Succeeded) { powerShellResults.ErrorRecords = Array.FindAll <ErrorRecord>(powerShellResults.ErrorRecords, (ErrorRecord x) => !(x.Exception is CouldNotGenerateExtensionException) && !(x.Exception is SipResourceIdAndExtensionsNeededException) && !(x.Exception is E164ResourceIdNeededException)); } if (powerShellResults.SucceededWithValue) { PowerShellResults <UMMailboxPolicy> powerShellResults2 = powerShellResults.MergeErrors <UMMailboxPolicy>(base.GetObject <UMMailboxPolicy>("Get-UMMailboxPolicy", properties.UMMailboxPolicy)); if (powerShellResults2.SucceededWithValue) { powerShellResults.Value.Policy = powerShellResults2.Value; } } return(powerShellResults); }
private PowerShellResults <ExtendedOrganizationalUnit> GetOrganizationalUnit(string ou, PowerShellResults <AdminRoleGroupRow> results) { OrganizationalUnits organizationalUnits = new OrganizationalUnits(); Identity identity = new Identity(ou, ou); return(results.MergeErrors <ExtendedOrganizationalUnit>(organizationalUnits.GetObject(identity))); }
private PowerShellResults <ViewDistributionGroupData> JoinOrLeaveGroup(Identity identity, string cmdlet) { PowerShellResults <ViewDistributionGroupData> powerShellResults = new PowerShellResults <ViewDistributionGroupData>(); PSCommand psCommand = new PSCommand().AddCommand(cmdlet).AddParameter("Identity", identity); powerShellResults.MergeErrors(base.Invoke(psCommand, identity, null)); return(powerShellResults); }
private void GetOriginalObject(Identity identity, SetAdminRoleGroupParameter properties, PowerShellResults <AdminRoleGroupRow> results) { PowerShellResults <AdminRoleGroupObject> powerShellResults = results.MergeErrors <AdminRoleGroupObject>(base.GetObject <AdminRoleGroupObject>(new PSCommand().AddCommand("Get-RoleGroup").AddParameter("ReadFromDomainController"), identity)); if (powerShellResults.SucceededWithValue) { properties.OriginalObject = powerShellResults.Value; } }
public PowerShellResults RemoveObjects(Identity[] identities, BaseWebServiceParameters parameters) { PowerShellResults powerShellResults = new PowerShellResults(); PowerShellResults <RetentionPolicyTagRow> powerShellResults2 = powerShellResults.MergeErrors <RetentionPolicyTagRow>(base.GetList <RetentionPolicyTagRow, AllAssociatedRPTsFilter>("Get-RetentionPolicyTag", new AllAssociatedRPTsFilter(), null)); if (powerShellResults2.Failed) { return(powerShellResults); } PSCommand pscommand = new PSCommand().AddCommand("Set-RetentionPolicyTag"); pscommand.AddParameter("Mailbox", RbacPrincipal.Current.ExecutingUserId); pscommand.AddParameter("OptionalInMailBox", (from x in powerShellResults2.Output select x.Identity.RawIdentity).Except(from i in identities select i.RawIdentity)); powerShellResults.MergeErrors(base.Invoke(pscommand)); return(powerShellResults); }
public PowerShellResults StopAndRetrieveLog(Identity[] identities, BaseWebServiceParameters parameters) { PSCommand pscommand = new PSCommand().AddCommand("Set-CASMailbox"); pscommand.AddParameter("Identity", Identity.FromExecutingUserId()); pscommand.AddParameter("ActiveSyncDebugLogging", false); PowerShellResults powerShellResults = base.Invoke(pscommand); PSCommand psCommand = new PSCommand().AddCommand("Get-MobileDeviceStatistics").AddParameter("GetMailboxLog", new SwitchParameter(true)); return(powerShellResults.MergeErrors(base.Invoke(psCommand, identities, parameters))); }
public PowerShellResults <ViewRetentionPolicyTagRow> GetObject(Identity identity) { PowerShellResults <ViewRetentionPolicyTagRow> @object = base.GetObject <ViewRetentionPolicyTagRow>("Get-RetentionPolicyTag", identity); PowerShellResults <ViewRetentionPolicyTagRow> powerShellResults = @object.MergeErrors <ViewRetentionPolicyTagRow>(base.GetList <ViewRetentionPolicyTagRow, OptInRPTsFilter>("Get-RetentionPolicyTag", new OptInRPTsFilter(), null)); if (@object.SucceededWithValue && powerShellResults.Succeeded && powerShellResults.Output.Contains(@object.Value)) { @object.Value.OptionalTag = true; } return(@object); }
private void UpdateRoleGroupMembers(Identity identity, Identity[] members, PowerShellResults <AdminRoleGroupRow> results) { if (members != null) { RoleGroupMembers roleGroupMembers = new RoleGroupMembers(); results.MergeErrors <RoleGroupMembersRow>(roleGroupMembers.SetObject(identity, new SetRoleGroupMembersParameter { Members = members })); } }
public PowerShellResults <GetVoiceMailConfiguration> RegisterPhone(Identity identity, SetVoiceMailConfiguration properties) { properties.FaultIfNull(); identity = Identity.FromExecutingUserId(); PowerShellResults <GetVoiceMailConfiguration> @object = this.GetObject(identity); if (@object.Failed || string.IsNullOrEmpty(properties.PhoneNumber)) { return(@object); } GetVoiceMailConfiguration value = @object.Value; value.VerificationCodeRequired = !this.IsPhoneVerified(properties.PhoneNumber, value); if (string.IsNullOrEmpty(properties.PhoneProviderId)) { properties.PhoneProviderId = value.PhoneProviderId; } if (value.VerificationCodeRequired) { if (!string.IsNullOrEmpty(properties.VerificationCode)) { @object.MergeErrors(this.ComparePasscode(identity, properties.VerificationCode)); value.VerificationCodeRequired = [email protected]; } else { PowerShellResults <SmsOptions> powerShellResults = this.SetTextMessagingAccount(identity, properties.PhoneNumber, properties.PhoneProviderId, value); @object.MergeErrors <SmsOptions>(powerShellResults); if (powerShellResults.SucceededWithValue) { value.SmsOptions = powerShellResults.Value; value.VerificationCodeRequired = !powerShellResults.Value.NotificationPhoneNumberVerified; if (value.VerificationCodeRequired) { @object.MergeErrors(this.SendVerificationCode(identity)); } } } } return(this.ClearOutputOnFailure(@object)); }
private PowerShellResults <ManagementScopeRow> GetManagementScope(string managementScope, PowerShellResults <AdminRoleGroupRow> results) { PowerShellResults <ManagementScopeRow> result = null; if (!string.IsNullOrEmpty(managementScope) && !ManagementScopeRow.IsDefaultScope(managementScope)) { ManagementScopes managementScopes = new ManagementScopes(); Identity identity = new Identity(managementScope, managementScope); result = results.MergeErrors <ManagementScopeRow>(managementScopes.GetObject(identity)); } return(result); }
protected PowerShellResults RemoveObjects(string removeCmdlet, Identity identity, Identity[] identities, string parameterNameForIdentities, WebServiceParameters parameters) { EcpPerfCounters.WebServiceRemoveObject.Increment(); PowerShellResults powerShellResults = new PowerShellResults(); foreach (Identity identity2 in identities) { PSCommand psCommand = new PSCommand().AddCommand(removeCmdlet).AddParameter("Identity", identity).AddParameter(parameterNameForIdentities, identity2.RawIdentity); powerShellResults.MergeErrors(this.Invoke(psCommand, identity, parameters)); } return(powerShellResults); }
public PowerShellResults <SchedulingOptionsConfiguration> SetObject(Identity identity, SetSchedulingOptionsConfiguration properties) { properties.FaultIfNull(); PowerShellResults <SchedulingOptionsConfiguration> powerShellResults = new PowerShellResults <SchedulingOptionsConfiguration>(); powerShellResults.MergeErrors <CalendarConfiguration>(base.SetObject <CalendarConfiguration, SetMailboxCalendarConfiguration>("Set-MailboxCalendarConfiguration", Identity.FromExecutingUserId(), properties.SetMailboxCalendarConfiguration)); if (powerShellResults.Failed) { return(powerShellResults); } powerShellResults.MergeAll(base.SetObject <SchedulingOptionsConfiguration, SetSchedulingOptionsConfiguration>(identity, properties)); return(powerShellResults); }
private PowerShellResults <MailboxRecipientRow> UpdateSupervisionListForTag(Identity identity, PowerShellResults <MailboxRecipientRow> results, IEnumerable <string> originalList, IEnumerable <string> newList, string tag) { if (newList == null) { newList = new List <string>(); } IEnumerable <string> second = newList.Intersect(originalList); IEnumerable <string> enumerable = originalList.Except(second); IEnumerable <string> enumerable2 = newList.Except(second); NewSupervisionListEntry newSupervisionListEntry = new NewSupervisionListEntry(); foreach (string entryName in enumerable2) { newSupervisionListEntry.Identity = identity; newSupervisionListEntry.EntryName = entryName; newSupervisionListEntry.Tag = tag; results.MergeErrors <SupervisionListEntry>(base.NewObject <SupervisionListEntry, NewSupervisionListEntry>("Add-SupervisionListEntry", newSupervisionListEntry)); if (results.Failed) { return(results); } } foreach (string value in enumerable) { PSCommand pscommand = new PSCommand().AddCommand("Remove-SupervisionListEntry"); pscommand.AddParameter("Entry", value); pscommand.AddParameter("Tag", tag); results.MergeErrors(base.RemoveObjects(pscommand, new Identity[] { identity }, null)); if (results.Failed) { return(results); } } return(results); }
public PowerShellResults <SchedulingOptionsConfiguration> GetObject(Identity identity) { PowerShellResults <SchedulingOptionsConfiguration> @object = base.GetObject <SchedulingOptionsConfiguration>(identity); if (@object.SucceededWithValue) { PowerShellResults <MailboxCalendarConfiguration> powerShellResults = @object.MergeErrors <MailboxCalendarConfiguration>(base.GetObject <MailboxCalendarConfiguration>("Get-MailboxCalendarConfiguration", Identity.FromExecutingUserId())); if (powerShellResults.SucceededWithValue) { @object.Value.MailboxCalendarConfiguration = powerShellResults.Value; } } return(@object); }
private void UpdateRoleAssignments(PowerShellResults <RoleAssignmentPolicy> result, SetRoleAssignmentPolicy properties) { RoleAssignmentPolicy value = result.Value; ManagementRoleAssignments managementRoleAssignments = new ManagementRoleAssignments(); Delta <Identity> delta = value.AssignedEndUserRoles.CalculateDelta(properties.AssignedEndUserRoles); if (delta.RemovedObjects != null && delta.RemovedObjects.Count > 0) { result.MergeErrors(this.RemoveRoleAssignments(delta.RemovedObjects, value, managementRoleAssignments)); if (result.Failed) { return; } } foreach (Identity role in delta.AddedObjects) { result.MergeErrors <ManagementRoleAssignment>(managementRoleAssignments.NewObject(new NewManagementRoleAssignment { Policy = value.Identity, Role = role })); } }
public PowerShellResults <SetUMMailboxPinConfiguration> GetObject(Identity identity) { PowerShellResults <SetUMMailboxPinConfiguration> @object = base.GetObject <SetUMMailboxPinConfiguration>("Get-UMMailbox", identity); if (@object.SucceededWithValue) { PowerShellResults <UMMailboxPin> powerShellResults = @object.MergeErrors <UMMailboxPin>(base.GetObject <UMMailboxPin>("Get-UMMailboxPin", identity)); if (powerShellResults.SucceededWithValue) { @object.Value.UMMailboxPin = powerShellResults.Value; } } return(@object); }
public PowerShellResults <SupervisionStatus> SetObject(Identity identity, SetSupervisionStatus properties) { identity = Identity.FromExecutingUserId(); properties.FaultIfNull(); PowerShellResults <SupervisionStatus> powerShellResults = new PowerShellResults <SupervisionStatus>(); powerShellResults.MergeErrors <SupervisionStatus>(base.SetObject <SupervisionStatus, SetSupervisionStatus>("Set-SupervisionPolicy", identity, properties)); if (powerShellResults.Failed) { return(powerShellResults); } powerShellResults.MergeAll(base.SetObject <SupervisionStatus, SetClosedCampusOutboundPolicyConfiguration>("Set-SupervisionPolicy", identity, properties.MyClosedCampusOutboundPolicyConfiguration)); return(powerShellResults); }
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); }
public PowerShellResults <SmsOptions> DisableObject(Identity identity) { identity = Identity.FromExecutingUserId(); PSCommand pscommand = new PSCommand(); pscommand.AddCommand("Clear-TextMessagingAccount"); PowerShellResults results = base.Invoke(pscommand, new Identity[] { identity }, null); PowerShellResults <SmsOptions> @object = this.GetObject(identity); @object.MergeErrors(results); return(@object); }
public PowerShellResults <SetUMMailboxConfiguration> SetObject(Identity identity, SetUMMailboxParameters properties) { PowerShellResults <SetUMMailboxConfiguration> powerShellResults = new PowerShellResults <SetUMMailboxConfiguration>(); properties.FaultIfNull(); properties.ReturnObjectType = ReturnObjectTypes.Full; if (properties.SetUMExtensionParameteres.SecondaryExtensions != null) { PowerShellResults <SetUMMailboxConfiguration> @object = this.GetObject(identity); powerShellResults.MergeErrors <SetUMMailboxConfiguration>(@object); if (@object.HasValue) { try { properties.SetUMExtensionParameteres.UpdateSecondaryExtensions(@object.Output[0].UMMailbox); } catch (ProxyAddressExistsException exception) { powerShellResults.ErrorRecords = new ErrorRecord[] { new ErrorRecord(exception) }; return(powerShellResults); } } PSCommand pscommand = new PSCommand().AddCommand("Set-Mailbox"); pscommand.AddParameter("Identity", identity); pscommand.AddParameters(properties.SetUMExtensionParameteres); powerShellResults.MergeErrors(base.Invoke(pscommand)); if (powerShellResults.Failed) { return(powerShellResults); } } return(base.SetObject <SetUMMailboxConfiguration, SetUMMailboxParameters>("Set-UMMailbox", identity, properties)); }