private ADRecipient FindRecipient(ADObjectId recipientId) { return(this.session.Read(recipientId)); }
// Token: 0x06000A6D RID: 2669 RVA: 0x00022A67 File Offset: 0x00020C67 public LogonableObjectIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
public FfoPagedReader(IDirectorySession session, QueryFilter filter, ADObjectId rootId) : this(session, rootId, QueryScope.SubTree, filter, null, ADGenericPagedReader <T> .DefaultPageSize, null, false) { }
// Token: 0x060008B0 RID: 2224 RVA: 0x0001EAA1 File Offset: 0x0001CCA1 public AvailabilityAddressSpaceIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
internal static bool Render(TextWriter writer, UserContext userContext, string displayName, string smtpAddress, string routingAddress, string routingType, string alias, AddressOrigin addressOrigin, int recipientFlags, StoreObjectId storeObjectId, EmailAddressIndex emailAddressIndex, ADObjectId adObjectId, RecipientWellNode.RenderFlags flags, string sipUri, string mobilePhoneNumber) { if (writer == null) { throw new ArgumentNullException("writer"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (string.CompareOrdinal(routingType, "SMTP") == 0 && ImceaAddress.IsImceaAddress(routingAddress) && Utilities.TryDecodeImceaAddress(routingAddress, ref routingType, ref routingAddress)) { smtpAddress = null; } bool flag = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None; bool flag2 = false; string text = "rwRR"; if (string.CompareOrdinal(routingType, "MAPIPDL") != 0 && (string.IsNullOrEmpty(routingAddress) || string.IsNullOrEmpty(routingType))) { if (string.IsNullOrEmpty(displayName)) { ExTraceGlobals.MailDataTracer.TraceDebug(0L, "Found recipient without an email address or display name"); return(false); } text = "rwUR"; flag2 = true; routingAddress = null; smtpAddress = null; routingType = null; } else if (string.IsNullOrEmpty(displayName)) { if (!string.IsNullOrEmpty(smtpAddress)) { displayName = smtpAddress; } else if (!string.IsNullOrEmpty(routingAddress)) { displayName = routingAddress; } } if (flag) { text = (flag2 ? "rwURO" : "rwRRO"); } if ((recipientFlags & 1) != 0) { text += " rwDL"; } if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None) { writer.Write(userContext.DirectionMark); writer.Write("; "); } if ((flags & RecipientWellNode.RenderFlags.RenderSkinnyHtml) != RecipientWellNode.RenderFlags.None) { if (!flag) { writer.Write("<span>"); } writer.Write("<span class=\""); } else if (flag) { writer.Write("<span id=\"spnR\" "); writer.Write(" "); Utilities.RenderScriptHandler(writer, "oncontextmenu", "onRwCm(event);"); writer.Write(" "); Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkReadRcp(event);"); writer.Write(" "); Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);"); writer.Write(" class=\""); } else { writer.Write("<span tabindex=\"-1\" contenteditable=\"false\">"); if (userContext.BrowserType == BrowserType.IE) { writer.Write("<span tabindex=\"-1\" contenteditable=\"true\" id=\"spnR\" "); } else { writer.Write("<span tabindex=\"-1\" contenteditable=\"false\" id=\"spnR\" "); } writer.Write(" "); Utilities.RenderScriptHandler(writer, "oncontextmenu", "onContextMenuSpnRw(event);"); writer.Write(" "); Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);"); writer.Write(" "); Utilities.RenderScriptHandler(writer, "onkeydown", "onKDRcp(event);"); writer.Write(" "); Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkRcp(event);"); writer.Write(" ondrop=\"return(false);\" class=\""); } writer.Write(text); writer.Write("\" _ao=\"{0}\" _rf=\"{1}\" _rt=\"", (int)addressOrigin, recipientFlags); if (routingType != null) { Utilities.SanitizeHtmlEncode(routingType, writer); } writer.Write("\" _em=\""); if (routingAddress != null) { Utilities.SanitizeHtmlEncode(routingAddress, writer); } if (storeObjectId != null) { writer.Write("\" _id=\""); Utilities.SanitizeHtmlEncode(storeObjectId.ToBase64String(), writer); writer.Write("\" _ei=\""); writer.Write((int)emailAddressIndex); } else if (adObjectId != null) { writer.Write("\" _id=\""); Utilities.SanitizeHtmlEncode(Convert.ToBase64String(adObjectId.ObjectGuid.ToByteArray()), writer); } writer.Write("\" title=\""); if (smtpAddress != null) { Utilities.SanitizeHtmlEncode(smtpAddress, writer); } if (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Directory && !userContext.IsFeatureEnabled(Feature.GlobalAddressList))) { if (smtpAddress != null) { writer.Write("\" _sa=\""); Utilities.SanitizeHtmlEncode(smtpAddress, writer); } else if (routingType != null && routingAddress != null) { writer.Write("\" _imcea=\""); Utilities.SanitizeHtmlEncode(ImceaAddress.Encode(routingType, routingAddress, OwaConfigurationManager.Configuration.DefaultAcceptedDomain.DomainName.ToString()), writer); } } if (userContext.IsInstantMessageEnabled() && userContext.InstantMessagingType == InstantMessagingTypeOptions.Ocs && sipUri != null) { writer.Write("\" "); if (adObjectId == null) { writer.Write("_sipTrsp=1 "); } writer.Write("_uri=\""); Utilities.SanitizeHtmlEncode(sipUri, writer); } if (userContext.IsSmsEnabled && mobilePhoneNumber != null) { writer.Write("\" _mo=\""); Utilities.SanitizeHtmlEncode(mobilePhoneNumber, writer); } if ((smtpAddress != null || routingAddress != null || mobilePhoneNumber != null || Utilities.IsMapiPDL(routingType)) && (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Store && (!userContext.IsFeatureEnabled(Feature.Contacts) || userContext.IsSmsEnabled)) || (addressOrigin == AddressOrigin.Directory && (!userContext.IsFeatureEnabled(Feature.GlobalAddressList) || userContext.IsSmsEnabled))) && displayName != null) { writer.Write("\" _dn=\""); Utilities.SanitizeHtmlEncode(displayName, writer); } if (!flag && alias != null) { writer.Write("\" _al=\""); Utilities.SanitizeHtmlEncode(alias, writer); } writer.Write("\">"); if (userContext.IsInstantMessageEnabled() && flag && !string.IsNullOrEmpty(routingType) && ((string.CompareOrdinal(routingType, "EX") == 0 && (recipientFlags & 1) == 0) || string.CompareOrdinal(routingType, "SMTP") == 0)) { RenderingUtilities.RenderPresenceJellyBean(writer, userContext, true, "onRwCmJb(event);", false, null); } if (displayName != null) { Utilities.SanitizeHtmlEncode(displayName, writer); } RecipientWellNode.RenderFormattedAddress(writer, userContext, displayName, smtpAddress, routingAddress, routingType); writer.Write("</span>"); if (!flag) { writer.Write("</span>"); } return(true); }
private static RawSecurityDescriptor ReadSecurityDescriptorWrapper(ITopologyConfigurationSession session, ADObjectId id, bool useConfigNC) { bool useConfigNC2 = session.UseConfigNC; session.UseConfigNC = useConfigNC; RawSecurityDescriptor result; try { result = session.ReadSecurityDescriptor(id); } finally { session.UseConfigNC = useConfigNC2; } return(result); }
public RmsTrustedPublishingDomainIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
private void OnInvokeWebServiceCompleted(IAsyncResult ar) { GetQueueDigestWebServiceImpl.WebServiceRequestAsyncState webServiceRequestAsyncState = (GetQueueDigestWebServiceImpl.WebServiceRequestAsyncState)ar.AsyncState; IDiagnosticsAggregationService client = webServiceRequestAsyncState.Client; ADObjectId serverToConnectTo = webServiceRequestAsyncState.ServerToConnectTo; int dagIndex = webServiceRequestAsyncState.DagIndex; string text = null; LocalizedString? localizedString = null; AggregatedViewResponse aggregatedViewResponse = null; try { if (webServiceRequestAsyncState.FailedOnBegin) { text = webServiceRequestAsyncState.FailedOnBeginException.ToString(); } else { aggregatedViewResponse = client.EndGetAggregatedView(ar); } } catch (FaultException <DiagnosticsAggregationFault> faultException) { text = string.Format("{0}: {1}", faultException.Detail.ErrorCode, faultException.Detail.Message); } catch (CommunicationException ex) { if (GetQueueDigestWebServiceImpl.IsQuotaExceeded(ex)) { localizedString = new LocalizedString?(Strings.GetQueueDigestQuotaExceeded(serverToConnectTo.Name)); } text = ex.ToString(); } catch (TimeoutException ex2) { text = ex2.ToString(); } finally { this.cmdlet.DisposeWebServiceClient(client); } bool flag = false; lock (this) { if (!webServiceRequestAsyncState.IsConnectingToDag || this.pendingRequestsToDag[dagIndex] != 0) { if (aggregatedViewResponse != null) { this.aggregator.AddAggregatedQueues(aggregatedViewResponse.QueueAggregatedViewResponse.AggregatedQueues); if (this.cmdlet.IsVerbose) { foreach (ServerSnapshotStatus serverSnapshotStatus in aggregatedViewResponse.SnapshotStatusOfServers) { this.verboseMessages.Add(new LocalizedString(string.Format("{0}: {1}", serverToConnectTo.Name, serverSnapshotStatus.ToString()))); } } if (webServiceRequestAsyncState.IsConnectingToDag) { this.pendingRequestsToDag[dagIndex] = 0; } } else if (webServiceRequestAsyncState.IsConnectingToDag) { this.pendingRequestsToDag[dagIndex]--; if (this.pendingRequestsToDag[dagIndex] > 0) { flag = true; } else { this.failedToConnectDags.Add(serverToConnectTo.Name); } } else { this.failedToConnectServers.Add(serverToConnectTo.Name); } if (text != null) { this.debugMessages.Add(new LocalizedString(string.Format("{0}: {1}", serverToConnectTo.Name, text))); } if (localizedString != null) { this.warningMessages.Add(localizedString.Value); } if (!flag) { this.webServiceRequestsPending--; } if (this.webServiceRequestsPending == 0) { this.webServiceRequestsDone.Set(); } } } }
public GetQueueDigestWebServiceImpl(GetQueueDigestAdapter cmdlet, ITopologyConfigurationSession session, ADObjectId localSiteId, int webServicePortNumber) { this.cmdlet = cmdlet; this.session = session; this.localSiteId = localSiteId; this.webServicePortNumber = webServicePortNumber; }
internal new void SetId(IConfigurationSession session, ADObjectId parent, string cn) { base.SetId(session, parent, cn); this.LegacyThrottlingPolicy.SetIdAndName(this); }
private void InvokeWebService(ADObjectId serverToConnectTo, HashSet <ADObjectId> serversToInclude, bool isConnectingToDag, int dagIndex, int portNumber) { string uri = string.Format(CultureInfo.InvariantCulture, DiagnosticsAggregationHelper.DiagnosticsAggregationEndpointFormat, new object[] { serverToConnectTo.Name, portNumber }); Exception ex = null; IDiagnosticsAggregationService diagnosticsAggregationService = null; try { diagnosticsAggregationService = this.cmdlet.CreateWebServiceClient(GetQueueDigestWebServiceImpl.GetWebServiceBinding(this.cmdlet.Timeout), new EndpointAddress(uri)); } catch (UriFormatException ex2) { ex = ex2; } List <string> list = new List <string>(); if (serversToInclude != null && serversToInclude.Count != 0) { foreach (ADObjectId adobjectId in serversToInclude) { list.Add(adobjectId.Name); } } AggregatedViewRequest aggregatedViewRequest = new AggregatedViewRequest(RequestType.Queues, list, uint.MaxValue); aggregatedViewRequest.QueueAggregatedViewRequest = new QueueAggregatedViewRequest(this.cmdlet.GroupBy, this.cmdlet.DetailsLevel, this.cmdlet.Filter); GetQueueDigestWebServiceImpl.WebServiceRequestAsyncState webServiceRequestAsyncState = new GetQueueDigestWebServiceImpl.WebServiceRequestAsyncState { Client = diagnosticsAggregationService, ServerToConnectTo = serverToConnectTo, ServersToInclude = serversToInclude, IsConnectingToDag = isConnectingToDag, DagIndex = dagIndex, WebServicePortNumber = portNumber }; try { if (diagnosticsAggregationService != null) { diagnosticsAggregationService.BeginGetAggregatedView(aggregatedViewRequest, new AsyncCallback(this.OnInvokeWebServiceCompleted), webServiceRequestAsyncState); } } catch (EndpointNotFoundException ex3) { ex = ex3; } catch (InsufficientMemoryException ex4) { ex = ex4; } catch (CommunicationException ex5) { ex = ex5; } catch (TimeoutException ex6) { ex = ex6; } if (ex != null) { webServiceRequestAsyncState.FailedOnBegin = true; webServiceRequestAsyncState.FailedOnBeginException = ex; ThreadPool.QueueUserWorkItem(new WaitCallback(this.ThreadProcForBeginGetAggregatedViewFailed), new AsyncResult(null, webServiceRequestAsyncState)); } }
public EdgeConfigStatus ValidateOneRecipient(EdgeConnectionInfo subscription, string proxyAddressToVerify) { ADObjectId adobjectId = null; string[] attributeNames = RecipientSchema.AttributeNames; string[] array = RecipientValidator.readAttributes; int num = attributeNames.Length; int num2 = array.Length; string[] array2 = new string[num + num2]; attributeNames.CopyTo(array2, 0); array.CopyTo(array2, num); Connection connection = null; EdgeConfigStatus result; try { connection = new Connection(this.DataSession.GetReadConnection(null, ref adobjectId)); List <ExSearchResultEntry> list = new List <ExSearchResultEntry>(); foreach (ExSearchResultEntry item in connection.PagedScan(null, "(proxyAddresses=" + proxyAddressToVerify + ")", SearchScope.Subtree, array2)) { list.Add(item); } if (list.Count == 0) { result = new RecipientConfigStatus(SyncStatus.NotSynchronized, "Recipient doesn't exist in source Active Directory"); } else if (list.Count > 1) { RecipientConfigStatus recipientConfigStatus = new RecipientConfigStatus(SyncStatus.NotSynchronized, "More than one recipient found in source Active Directory and may cause NDR on Edge server. RecipientStatus.ConflictObjects contains relevant entries."); foreach (ExSearchResultEntry exSearchResultEntry in list) { recipientConfigStatus.ConflictObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName)); } result = recipientConfigStatus; } else { string hashedFormWithPrefix = this.proxyAddressHasher.GetHashedFormWithPrefix(proxyAddressToVerify.Substring(5)); List <ExSearchResultEntry> list2 = new List <ExSearchResultEntry>(); foreach (ExSearchResultEntry item2 in subscription.EdgeConnection.PagedScan(this.ADAMSearchPath, "(proxyAddresses=" + hashedFormWithPrefix + ")", SearchScope.Subtree, array2)) { list2.Add(item2); } if (list2.Count > 1) { RecipientConfigStatus recipientConfigStatus2 = new RecipientConfigStatus(SyncStatus.NotSynchronized, "More than one recipient found in target Edge Server and may cause NDR on Edge server. RecipientStatus.ConflictObjects contains relevant entries."); foreach (ExSearchResultEntry exSearchResultEntry2 in list2) { recipientConfigStatus2.ConflictObjects.Add(new ADObjectId(exSearchResultEntry2.DistinguishedName)); } result = recipientConfigStatus2; } else { ExSearchResultEntry exSearchResultEntry3 = list[0]; DirectoryAttribute directoryAttribute = exSearchResultEntry3.Attributes["objectGUID"]; Guid guid = new Guid((byte[])directoryAttribute.GetValues(typeof(byte[]))[0]); string absolutePath = "cn=" + guid.ToString() + "," + this.ADAMSearchPath; ExSearchResultEntry exSearchResultEntry4 = subscription.EdgeConnection.ReadObjectEntry(absolutePath, array2); if (exSearchResultEntry4 == null) { result = new RecipientConfigStatus(SyncStatus.NotSynchronized, "Recipient doesn't exist in target Edge Server and may cause NDR on Edge server") { OrgOnlyObjects = { new ADObjectId(exSearchResultEntry3.DistinguishedName) } }; } else if (!this.CompareAttributes(exSearchResultEntry4, exSearchResultEntry3, attributeNames)) { result = new RecipientConfigStatus(SyncStatus.NotSynchronized, "Recipient exists in target Edge Server but attributes are not synchronized") { ConflictObjects = { new ADObjectId(exSearchResultEntry3.DistinguishedName) } }; } else { DirectoryAttribute directoryAttribute2 = null; bool flag = false; if (exSearchResultEntry4.Attributes.TryGetValue("msExchRequireAuthToSendTo", out directoryAttribute2) && directoryAttribute2 != null && directoryAttribute2.Count > 0 && bool.TryParse((string)directoryAttribute2[0], out flag) && flag) { result = new RecipientConfigStatus(SyncStatus.Synchronized, "Recipient requires sender authentication and this may cause NDR on Edge server. RecipientStatus.ConflictObjects contains the recipient object in source Active Directory") { ConflictObjects = { new ADObjectId(exSearchResultEntry3.DistinguishedName) } }; } else { result = new RecipientConfigStatus(SyncStatus.Synchronized, null); } } } } } catch (ExDirectoryException ex) { result = new RecipientConfigStatus(SyncStatus.DirectoryError, ex.Message); } catch (ADTransientException ex2) { result = new RecipientConfigStatus(SyncStatus.DirectoryError, ex2.Message); } catch (ADOperationException ex3) { result = new RecipientConfigStatus(SyncStatus.DirectoryError, ex3.Message); } finally { if (connection != null) { connection.Dispose(); connection = null; } } return(result); }
private void ValidateExchangeServerRecipient(EdgeConfigStatus status) { Connection connection = null; if (status.SyncStatus != SyncStatus.NotSynchronized && status.SyncStatus != SyncStatus.Synchronized) { return; } try { ADObjectId adobjectId = null; string absolutePath = "CN=" + ADMicrosoftExchangeRecipient.DefaultName + ",CN=Transport Settings," + this.orgConfigRoot; string absolutePath2 = "CN=" + ADMicrosoftExchangeRecipient.DefaultName + ",CN=Transport Settings," + base.AdamRootPath; connection = new Connection(this.DataSession.GetReadConnection(null, ref adobjectId)); ExSearchResultEntry exSearchResultEntry = connection.ReadObjectEntry(absolutePath, Schema.ExchangeRecipient.PayloadAttributes); ExSearchResultEntry exSearchResultEntry2 = base.CurrentEdgeConnection.EdgeConnection.ReadObjectEntry(absolutePath2, Schema.ExchangeRecipient.PayloadAttributes); if (exSearchResultEntry != exSearchResultEntry2) { if (exSearchResultEntry == null) { status.SyncStatus = SyncStatus.NotSynchronized; if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.EdgeOnlyObjects.Count)) { status.EdgeOnlyObjects.Add(new ADObjectId(exSearchResultEntry2.DistinguishedName)); } } else if (exSearchResultEntry2 == null) { status.SyncStatus = SyncStatus.NotSynchronized; if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.OrgOnlyObjects.Count)) { status.OrgOnlyObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName)); } } else { if (!base.CompareAttributes(exSearchResultEntry2, exSearchResultEntry, Schema.ExchangeRecipient.PayloadAttributes)) { status.SyncStatus = SyncStatus.NotSynchronized; if (base.MaxReportedLength.IsUnlimited || (ulong)base.MaxReportedLength.Value > (ulong)((long)status.ConflictObjects.Count)) { status.ConflictObjects.Add(new ADObjectId(exSearchResultEntry.DistinguishedName)); } } if (status.SyncStatus == SyncStatus.Synchronized) { status.SynchronizedObjects += 1U; } } } } catch (ExDirectoryException) { status.SyncStatus = SyncStatus.DirectoryError; } finally { if (connection != null) { connection.Dispose(); connection = null; } } }
public ADQueryPolicyIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.DataObject }); try { try { MailboxDatabase mailboxDatabase = this.ConfigurationSession.Read <MailboxDatabase>((ADObjectId)this.DataObject.Identity); Server server = null; ADComputer adcomputer = null; bool useConfigNC = this.ConfigurationSession.UseConfigNC; bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog; if (mailboxDatabase != null) { server = mailboxDatabase.GetServer(); try { this.ConfigurationSession.UseConfigNC = false; this.ConfigurationSession.UseGlobalCatalog = true; adcomputer = ((ITopologyConfigurationSession)this.ConfigurationSession).FindComputerByHostName(server.Name); } finally { this.ConfigurationSession.UseConfigNC = useConfigNC; this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog; } if (adcomputer == null) { base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorDBOwningServerNotFound(mailboxDatabase.Identity.ToString())), ErrorCategory.ObjectNotFound, server.Identity); } ADObjectId adobjectId = adcomputer.Id.DomainId; adobjectId = adobjectId.GetChildId("Microsoft Exchange System Objects"); adobjectId = adobjectId.GetChildId("SystemMailbox" + mailboxDatabase.Guid.ToString("B")); string identity = adobjectId.ToDNString(); GeneralMailboxIdParameter generalMailboxIdParameter = GeneralMailboxIdParameter.Parse(identity); base.WriteVerbose(TaskVerboseStringHelper.GetFindByIdParameterVerboseString(generalMailboxIdParameter, this.RecipientSession, typeof(ADRecipient), null)); IEnumerable <ADSystemMailbox> objects = generalMailboxIdParameter.GetObjects <ADSystemMailbox>(adobjectId, this.RecipientSession); using (IEnumerator <ADSystemMailbox> enumerator = objects.GetEnumerator()) { if (enumerator.MoveNext()) { ADSystemMailbox adsystemMailbox = enumerator.Current; } else { NewMailboxDatabase.SaveSystemMailbox(mailboxDatabase, mailboxDatabase.GetServer(), base.RootOrgContainerId, (ITopologyConfigurationSession)this.ConfigurationSession, this.RecipientSession, null, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } } } base.WriteVerbose(Strings.VerboseMountDatabase(this.Identity.ToString())); this.RequestMount(MountFlags.None); if (!this.DataObject.DatabaseCreated) { this.DataObject.DatabaseCreated = true; base.InternalProcessRecord(); } } catch (AmServerException ex) { Exception ex2; if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("Database already mounted (database={0}, exception={1})", new object[] { this.DataObject.Name, ex2.Message }); } else if (ex.TryGetInnerExceptionOfType(out ex2) || ex.TryGetInnerExceptionOfType(out ex2)) { this.AttemptForcedMountIfNecessary(this.Force, Strings.ContinueMountWhenDBFilesNotExist, Strings.VerboseMountDatabaseForcely(this.Identity.ToString()), Strings.ErrorFailedToMountReplicatedDbWithMissingEdbFile(this.Identity.ToString()), ex, MountFlags.ForceDatabaseCreation); } else if (ex.TryGetInnerExceptionOfType(out ex2)) { this.PromptForMountIfNecessary(this.AcceptDataLoss, Strings.ContinueMountWithDataLoss, Strings.VerboseMountDatabaseDataLoss(this.Identity.ToString()), MountFlags.AcceptDataLoss); } else { TaskLogger.Trace("MountDatabase.InternalProcessRecord raises exception while mounting database: {0}", new object[] { ex.Message }); base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMountDatabase(this.Identity.ToString(), ex.Message), ex), ErrorCategory.InvalidOperation, this.DataObject.Identity); } } } catch (AmServerException ex3) { TaskLogger.Trace("MountDatabase.InternalProcessRecord raises exception while mounting database: {0}", new object[] { ex3.Message }); base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMountDatabase(this.Identity.ToString(), ex3.Message), ex3), ErrorCategory.InvalidOperation, this.DataObject.Identity); } catch (AmServerTransientException ex4) { TaskLogger.Trace("MountDatabase.InternalProcessRecord raises exception while mounting database: {0}", new object[] { ex4.Message }); base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMountDatabase(this.Identity.ToString(), ex4.Message), ex4), ErrorCategory.InvalidOperation, this.DataObject.Identity); } finally { TaskLogger.LogExit(); } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); PromptPreviewRpcRequest request = null; ObjectId identity = null; string parameterSetName; switch (parameterSetName = base.ParameterSetName) { case "AACustomGreeting": request = new UMAACustomPromptRpcRequest(base.AutoAttendant, this.PromptFileName); identity = base.AutoAttendant.Identity; goto IL_1ED; case "AfterHoursWelcomeGreeting": request = UMAAWelcomePromptRpcRequest.AfterHoursWithCustomBusinessName(base.AutoAttendant, this.TestBusinessName); identity = base.AutoAttendant.Identity; goto IL_1ED; case "AfterHoursWelcomeGreetingAndMenu": request = UMAAWelcomePromptRpcRequest.AfterHoursWithCustomKeyMapping(base.AutoAttendant, this.TestMenuKeyMapping); identity = base.AutoAttendant.Identity; goto IL_1ED; case "BusinessHours": request = new UMAABusinessHoursPromptRpcRequest(base.AutoAttendant); identity = base.AutoAttendant.Identity; goto IL_1ED; case "BusinessLocation": request = new UMAABusinessLocationPromptRpcRequest(base.AutoAttendant); identity = base.AutoAttendant.Identity; goto IL_1ED; case "BusinessHoursWelcomeGreeting": request = UMAAWelcomePromptRpcRequest.BusinessHoursWithCustomBusinessName(base.AutoAttendant, this.TestBusinessName); identity = base.AutoAttendant.Identity; goto IL_1ED; case "BusinessHoursWelcomeGreetingAndMenu": request = UMAAWelcomePromptRpcRequest.BusinessHoursWithCustomKeyMapping(base.AutoAttendant, this.TestMenuKeyMapping); identity = base.AutoAttendant.Identity; goto IL_1ED; case "DPCustomGreeting": request = new UMDPCustomPromptRpcRequest(this.DataObject, this.PromptFileName); identity = this.DataObject.Identity; goto IL_1ED; } ExAssert.RetailAssert(false, "Invalid parameter set {0}", new object[] { base.ParameterSetName }); try { IL_1ED: ADObjectId adobjectId = (base.AutoAttendant == null) ? ((ADObjectId)this.DataObject.Identity) : base.AutoAttendant.UMDialPlan; UMPrompt umprompt = new UMPrompt(identity); umprompt.AudioData = this.GetUMPromptPreview(request, adobjectId.ObjectGuid); if (base.ParameterSetName == "DPCustomGreeting" || base.ParameterSetName == "AACustomGreeting") { umprompt.Name = this.PromptFileName; } else { umprompt.Name = base.ParameterSetName; } base.WriteObject(umprompt); } catch (LocalizedException exception) { base.WriteError(exception, ErrorCategory.NotSpecified, null); } TaskLogger.LogExit(); }
// Token: 0x06000722 RID: 1826 RVA: 0x0001A8EA File Offset: 0x00018AEA public TaskUserInfo(OrganizationId executingUserOrganizationId, OrganizationId currentOrganizationId, ADObjectId executingUserId, string executingUserIdentityName, SmtpAddress executingWindowsLiveId) { this.ExecutingUserOrganizationId = executingUserOrganizationId; this.CurrentOrganizationId = currentOrganizationId; this.ExecutingUserId = executingUserId; this.ExecutingUserIdentityName = executingUserIdentityName; this.ExecutingWindowsLiveId = executingWindowsLiveId; }
protected void AddToADQueryList(UserResultMapping userResultMapping, OrganizationId organizationId, ADObjectId searchRoot, IBudget budget) { ExTraceGlobals.FrameworkTracer.TraceDebug <string>((long)this.GetHashCode(), "AddToADQueryList() called for '{0}'.", userResultMapping.Mailbox); ADQueryList adqueryList; if (!this.adQueryListDictionary.TryGetValue(organizationId, out adqueryList)) { adqueryList = new ADQueryList(organizationId, searchRoot, budget); this.adQueryListDictionary.Add(organizationId, adqueryList); this.queryLists.Add(adqueryList); } adqueryList.Add(userResultMapping); }
public RoleIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
// Token: 0x06000016 RID: 22 RVA: 0x00002D24 File Offset: 0x00000F24 internal static EcpVdirConfiguration CreateInstance(ITopologyConfigurationSession session, ADObjectId virtualDirectoryDN) { ADEcpVirtualDirectory adecpVirtualDirectory = null; ADEcpVirtualDirectory[] array = session.Find <ADEcpVirtualDirectory>(virtualDirectoryDN, 0, null, null, 1, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\fba\\EcpVdirConfiguration.cs", 52, "CreateInstance"); if (array != null && array.Length == 1) { adecpVirtualDirectory = array[0]; } if (adecpVirtualDirectory == null) { throw new ADNoSuchObjectException(LocalizedString.Empty); } return(new EcpVdirConfiguration(adecpVirtualDirectory)); }
// Token: 0x060008E1 RID: 2273 RVA: 0x0001F322 File Offset: 0x0001D522 public ClientAccessServerOrArrayIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
protected override void InternalValidate() { TaskLogger.LogEnter(); try { base.ValidateRootFolders(this.SourceRootFolder, this.TargetRootFolder); bool wildcardedSearch = false; if (!string.IsNullOrEmpty(base.Name)) { base.ValidateName(); base.RequestName = base.Name; } else { wildcardedSearch = true; base.RequestName = "MailboxRestore"; } this.targetUser = RequestTaskHelper.ResolveADUser(base.RecipSession, base.GCSession, base.ServerSettings, this.TargetMailbox, base.OptionalIdentityData, base.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true); this.CheckForInvalidPublicFolderRestoreParameters(); if (this.targetUser.HasLocalArchive && this.targetUser.RecipientType == RecipientType.MailUser && this.targetUser.Database == null && !this.TargetIsArchive) { base.WriteError(new MissingArchiveParameterForRestorePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (this.targetUser.RecipientType != RecipientType.UserMailbox && (!this.TargetIsArchive || this.targetUser.RecipientType != RecipientType.MailUser)) { base.WriteError(new InvalidRecipientTypePermanentException(this.targetUser.ToString(), this.targetUser.RecipientType.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (this.TargetIsArchive && (this.targetUser.ArchiveGuid == Guid.Empty || this.targetUser.ArchiveDatabase == null)) { base.WriteError(new MailboxLacksArchivePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetIsArchive); } if (!this.TargetIsArchive && this.targetUser.Database == null) { base.WriteError(new MailboxLacksDatabasePermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } if (base.ParameterSetName.Equals("RemoteMailboxRestore")) { if (!Guid.TryParse(this.SourceStoreMailbox.RawIdentity, out this.sourceMailboxGuid)) { base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("SourceStoreMailbox")), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } if (!base.Fields.IsModified("AllowLegacyDNMismatch") || !this.AllowLegacyDNMismatch) { base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("AllowLegacyDNMismatch")), ErrorCategory.InvalidArgument, this.AllowLegacyDNMismatch); } base.Flags = (RequestFlags.CrossOrg | RequestFlags.Pull); switch (this.RemoteRestoreType) { case RemoteRestoreType.RecoveryDatabase: this.restoreFlags |= MailboxRestoreType.Recovery; this.restoreFlags |= MailboxRestoreType.SoftDeleted; break; case RemoteRestoreType.DisconnectedMailbox: this.restoreFlags |= MailboxRestoreType.SoftDeleted; break; case RemoteRestoreType.SoftDeletedRecipient: this.restoreFlags |= MailboxRestoreType.SoftDeletedRecipient; break; default: base.WriteError(new RecipientTaskException(Strings.ErrorParameterValueNotAllowed("RemoteRestoreType")), ErrorCategory.InvalidArgument, this.RemoteRestoreType); break; } } else { base.Flags = (RequestFlags.IntraOrg | RequestFlags.Pull); string fqdn; string serverExchangeLegacyDn; ADObjectId adobjectId; int num; MailboxDatabase mailboxDatabase = base.CheckDatabase <MailboxDatabase>(this.SourceDatabase, NewRequest <MailboxRestoreRequest> .DatabaseSide.Source, this.SourceDatabase, out fqdn, out serverExchangeLegacyDn, out adobjectId, out num); if (mailboxDatabase.Recovery) { this.restoreFlags |= MailboxRestoreType.Recovery; } this.sourceDatabase = mailboxDatabase.Id; this.SourceStoreMailbox.Flags |= 1UL; using (MapiSession mapiSession = new MapiAdministrationSession(serverExchangeLegacyDn, Fqdn.Parse(fqdn))) { using (MailboxStatistics mailboxStatistics = (MailboxStatistics)base.GetDataObject <MailboxStatistics>(this.SourceStoreMailbox, mapiSession, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(mailboxDatabase), new LocalizedString?(Strings.ErrorStoreMailboxNotFound(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorStoreMailboxNotUnique(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())))) { MailboxState?disconnectReason = mailboxStatistics.DisconnectReason; if (mailboxStatistics.MailboxType == StoreMailboxType.PublicFolderPrimary || mailboxStatistics.MailboxType == StoreMailboxType.PublicFolderSecondary) { this.restoreFlags |= MailboxRestoreType.PublicFolderMailbox; } bool flag = false; if (disconnectReason == null && !mailboxDatabase.Recovery) { mapiSession.Administration.SyncMailboxWithDS(mailboxDatabase.Guid, mailboxStatistics.MailboxGuid); using (MailboxStatistics mailboxStatistics2 = (MailboxStatistics)base.GetDataObject <MailboxStatistics>(this.SourceStoreMailbox, mapiSession, MapiTaskHelper.ConvertDatabaseADObjectToDatabaseId(mailboxDatabase), new LocalizedString?(Strings.ErrorStoreMailboxNotFound(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())), new LocalizedString?(Strings.ErrorStoreMailboxNotUnique(this.SourceStoreMailbox.ToString(), this.SourceDatabase.ToString())))) { disconnectReason = mailboxStatistics2.DisconnectReason; if (disconnectReason == null) { if (this.targetUser.OrganizationId != null && this.targetUser.OrganizationId.OrganizationalUnit != null && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled) { IRecipientSession recipientSession = CommonUtils.CreateRecipientSession(mailboxStatistics.ExternalDirectoryOrganizationId, null, null); ADRecipient adrecipient = this.TargetIsArchive ? recipientSession.FindByExchangeGuidIncludingArchive(mailboxStatistics.MailboxGuid) : recipientSession.FindByExchangeGuid(mailboxStatistics.MailboxGuid); flag = (adrecipient != null && adrecipient.RecipientSoftDeletedStatus != 0); } if (!this.IsPublicFolderMailboxRestore && !flag) { base.WriteError(new CannotRestoreConnectedMailboxPermanentException(this.SourceStoreMailbox.ToString()), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } } } } if (flag) { this.restoreFlags |= MailboxRestoreType.SoftDeletedRecipient; } else if (disconnectReason != null) { if (disconnectReason != MailboxState.SoftDeleted) { this.restoreFlags |= MailboxRestoreType.Disabled; } else { this.restoreFlags |= MailboxRestoreType.SoftDeleted; } } this.sourceMailboxGuid = mailboxStatistics.MailboxGuid; this.sourceMailboxDN = mailboxStatistics.LegacyDN; } } if ((this.TargetIsArchive && this.sourceMailboxGuid == this.targetUser.ArchiveGuid && this.sourceDatabase.Equals(this.targetUser.ArchiveDatabase)) || (!this.TargetIsArchive && this.sourceMailboxGuid == this.targetUser.ExchangeGuid && this.sourceDatabase.Equals(this.targetUser.Database))) { base.WriteError(new CannotRestoreIntoSelfPermanentException(this.targetUser.ToString()), ErrorCategory.InvalidArgument, this.TargetMailbox); } } if (this.restoreFlags.HasFlag(MailboxRestoreType.PublicFolderMailbox)) { if (this.targetUser.RecipientTypeDetails != RecipientTypeDetails.PublicFolderMailbox) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotRestoreFromPublicToPrivateMailbox), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } } else if (this.targetUser.RecipientTypeDetails == RecipientTypeDetails.PublicFolderMailbox) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotRestoreFromPrivateToPublicMailbox), ErrorCategory.InvalidArgument, this.SourceStoreMailbox); } base.RescopeToOrgId(this.targetUser.OrganizationId); if (base.ParameterSetName.Equals("RemoteMailboxRestore")) { base.PerRecordReportEntries.Add(new ReportEntry(MrsStrings.ReportRequestAllowedMismatch(base.ExecutingUserIdentity))); } else { base.ValidateLegacyDNMatch(this.sourceMailboxDN, this.targetUser, this.TargetMailbox); } ADObjectId mdbId = null; ADObjectId mdbServerSite = null; this.LocateAndChooseMdb(null, this.TargetIsArchive ? this.targetUser.ArchiveDatabase : this.targetUser.Database, null, this.TargetMailbox, this.TargetMailbox, out mdbId, out mdbServerSite); base.MdbId = mdbId; base.MdbServerSite = mdbServerSite; base.RequestName = this.CheckRequestNameAvailability(base.RequestName, this.targetUser.Id, true, MRSRequestType.MailboxRestore, this.TargetMailbox, wildcardedSearch); base.InternalValidate(); } finally { TaskLogger.LogExit(); } }
public override SearchErrorInfo AbortEx(SearchId searchId, string userId) { MailboxSearchServer.Tracer.TraceFunction <string>((long)this.GetHashCode(), "MailboxSearchServer.Abort on {0}", searchId.SearchName); SearchErrorInfo errorInfo = null; SearchUtils.ExWatsonWrappedCall(delegate() { lock (this) { if (!this.searchWorkItemMap.ContainsKey(searchId) && !this.pendingSearchIdMap.ContainsKey(searchId)) { MailboxSearchServer.Tracer.TraceWarning <string>((long)this.GetHashCode(), "The search {0} is not started", searchId.SearchName); try { ADObjectId discoverySystemMailboxId = new ADObjectId(searchId.MailboxDsName, searchId.MailboxGuid); IMailboxSearchConfigurationProvider mailboxSearchConfigurationProvider = new MailboxSearchConfigurationProvider(discoverySystemMailboxId, searchId.SearchName); if (MailboxDiscoverySearch.IsInProgressState(mailboxSearchConfigurationProvider.SearchObject.Status)) { mailboxSearchConfigurationProvider.SearchObject.UpdateState(SearchStateTransition.Fail); mailboxSearchConfigurationProvider.UpdateSearchObject("AbortEx", 317); } errorInfo = new SearchErrorInfo(262658, Strings.SearchNotStarted); goto IL_3A4; } catch (FormatException exception) { errorInfo = new SearchErrorInfo(-2147220990, exception); goto IL_3A4; } catch (SearchObjectNotFoundException exception2) { errorInfo = new SearchErrorInfo(-2147220990, exception2); goto IL_3A4; } catch (DataSourceOperationException exception3) { errorInfo = new SearchErrorInfo(-2147220990, exception3); goto IL_3A4; } } if (this.searchWorkItemMap.ContainsKey(searchId)) { MailboxSearchWorkItem searchWorkItem = this.searchWorkItemMap[searchId]; if (searchWorkItem.IsCompleted) { goto IL_3A4; } try { searchWorkItem.Abort(userId); } catch (ExportException ex) { MailboxSearchServer.Tracer.TraceError <ExportException>((long)this.GetHashCode(), "MailboxSearchServer.Abort error {0}", ex); errorInfo = new SearchErrorInfo(-2147220991, ex); } catch (DataSourceOperationException ex2) { MailboxSearchServer.Tracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "MailboxSearchServer.Abort error {0}", ex2); errorInfo = new SearchErrorInfo(-2147220991, ex2); } lock (this.workItemQueue) { int num = this.workItemQueue.FindIndex((MailboxSearchWorkItem x) => x == searchWorkItem); if (num != -1) { if (num != 0) { this.workItemQueue.RemoveAt(num); this.workItemQueue.Insert(0, searchWorkItem); } int num2 = this.workItemSemaphore.Release(); MailboxSearchServer.Tracer.TraceDebug <int, int>((long)this.GetHashCode(), "MailboxSearch is aborted with Queue Length {0} and semaphore {1}", this.workItemQueue.Count, num2 + 1); SearchEventLogger.Instance.LogDiscoverySearchWorkItemQueueChangedEvent("MovedToFrontOfQueueOnAbort", searchId.SearchName, searchId.MailboxDsName, searchWorkItem.Action.ToString(), searchWorkItem.IsEstimateOnly, this.workItemQueue.Count, this.searchWorkItemMap.Count, this.copySearchesInProgress, num2 + 1); } goto IL_3A4; } } if (this.pendingSearchIdMap.ContainsKey(searchId)) { this.pendingSearchIdMap.Remove(searchId); SearchEventLogger.Instance.LogDiscoverySearchPendingWorkItemsChangedEvent("RemovedFromPendingWorkItemsOnAbort", searchId.SearchName, searchId.MailboxDsName, this.pendingSearchIdMap.Count); } IL_3A4:; } }); if (errorInfo != null && errorInfo.Failed) { MailboxSearchServer.LogErrorInfo("Error occured when trying to abort the search workitem", searchId, errorInfo); } return(errorInfo); }
public ActiveSyncDeviceClassIdParameter(ADObjectId adObjectId) : base(adObjectId) { }
internal ElcContentSettings(IDirectorySession session, ADObjectId elcFolderId, string name) { this.m_Session = session; base.SetId(elcFolderId.GetChildId(name)); }
private void RemoveExternalDirOrgIdFromCU(ITenantConfigurationSession session, ADObjectId cuObjId) { ExchangeConfigurationUnit exchangeConfigurationUnit = session.Read <ExchangeConfigurationUnit>(cuObjId); exchangeConfigurationUnit.ExternalDirectoryOrganizationId = null; session.Save(exchangeConfigurationUnit); }
public FfoPagedReader(IDirectorySession session, QueryFilter filter, ADObjectId rootId, int pageSize) : this(session, rootId, QueryScope.SubTree, filter, null, pageSize, null, false) { }
protected override void InternalValidate() { TaskLogger.LogEnter(); try { base.InternalValidate(); if (!base.HasErrors) { if (MobileDeviceTaskHelper.IsRunningUnderMyOptionsRole(this, base.TenantGlobalCatalogSession, base.SessionSettings)) { ADObjectId id; if (!base.TryGetExecutingUserId(out id)) { throw new ExecutingUserPropertyNotFoundException("executingUserid"); } if (!this.DataObject.Id.Parent.Parent.Equals(id)) { base.WriteError(new LocalizedException(Strings.ErrorObjectNotFound(this.Identity.ToString())), ErrorCategory.InvalidArgument, null); } } IRecipientSession recipientSession = this.CreateTenantGlobalCatalogSession(base.SessionSettings); Exception ex = null; MailboxIdParameter mailboxId = this.Identity.GetMailboxId(); if (mailboxId == null && this.DataObject != null) { this.Identity = new MobileDeviceIdParameter(this.DataObject); mailboxId = this.Identity.GetMailboxId(); } if (mailboxId == null) { base.WriteError(new LocalizedException(Strings.ErrorObjectNotFound(this.Identity.ToString())), ErrorCategory.InvalidArgument, null); } ADUser adObject = null; this.principal = MobileDeviceTaskHelper.GetExchangePrincipal(base.SessionSettings, recipientSession, mailboxId, "Clear-MobileDevice", out ex, out adObject); if (ex != null) { base.WriteError(ex, ErrorCategory.InvalidArgument, null); } IList <LocalizedString> list = null; ADObjectId adobjectId = null; base.TryGetExecutingUserId(out adobjectId); this.validatedAddresses = MobileDeviceTaskHelper.ValidateAddresses(recipientSession, adobjectId, this.NotificationEmailAddresses, out list); if (list != null) { foreach (LocalizedString text in list) { this.WriteWarning(text); } } base.VerifyIsWithinScopes((IDirectorySession)base.DataSession, adObject, true, new DataAccessTask <MobileDevice> .ADObjectOutOfScopeString(Strings.ErrorCannotChangeMailboxOutOfWriteScope)); if (adobjectId != null) { ExchangePrincipal exchangePrincipal = MobileDeviceTaskHelper.GetExchangePrincipal(base.SessionSettings, recipientSession, new MailboxIdParameter(adobjectId), "Clear-MobileDevice", out ex); if (ex != null) { base.WriteWarning(ex.ToString()); } if (exchangePrincipal != null) { this.wipeRequestorSMTP = exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString(); } else { this.wipeRequestorSMTP = null; } } } } finally { TaskLogger.LogExit(); } }
public FfoPagedReader(IDirectorySession session, ADObjectId rootId, QueryScope queryScope, QueryFilter filter, SortBy sortBy, int pageSize, IEnumerable <PropertyDefinition> properties, bool skipCheckVirtualIndex) : base(session, rootId, queryScope, filter, sortBy, pageSize, properties, skipCheckVirtualIndex) { this.properties = properties; this.queryFilter = filter; }
// Token: 0x0600108A RID: 4234 RVA: 0x00060890 File Offset: 0x0005EA90 internal void GetMetricsForSingleGroup(IRecipientSession session, string groupDN, TypedHashSet calculatedGroups, Dictionary <string, object> parentGroupDictionary, IList <string> parentGroupList) { ADObjectId id = new ADObjectId(groupDN); ADRawEntry group = null; ADOperationResult adoperationResult = this.TryRunPerGroupADOperation(delegate { group = session.ReadADRawEntry(id, GroupMetricsGenerator.groupProperties); }, groupDN); if (!adoperationResult.Succeeded || group == null) { return; } ulong hash = GroupMetricsUtility.GetHash(group.Id.ObjectGuid); if (calculatedGroups.Contains(hash)) { return; } int externalMemberCount = 0; HashSet <ulong> allMemberHashes = new HashSet <ulong>(2000); ADRecipientExpansion expander = new ADRecipientExpansion(session, false); adoperationResult = this.TryRunPerGroupADOperation(delegate { if (GroupMetricsUtility.Fault == GroupMetricsFault.TransientExceptionInExpansion) { throw new ADTransientException(new LocalizedString("Fault Injection")); } if (GroupMetricsUtility.Fault == GroupMetricsFault.InvalidCredentialExceptionInExpansion) { throw new ADInvalidCredentialException(new LocalizedString("Fault Injection")); } if (GroupMetricsUtility.Fault == GroupMetricsFault.PermanentExceptionInExpansion) { throw new DataSourceOperationException(new LocalizedString("Fault Injection")); } expander.Expand(group, delegate(ADRawEntry member, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentExpansionType) { this.RunData.ThrowIfShuttingDown(); if (recipientExpansionType == ExpansionType.GroupMembership) { return(ExpansionControl.Continue); } ulong hash2 = GroupMetricsUtility.GetHash(member.Id.ObjectGuid); if (allMemberHashes.TryAdd(hash2) && this.IsExternal(member)) { externalMemberCount++; } if (allMemberHashes.Count >= 1000) { return(ExpansionControl.Terminate); } if (recipientExpansionType != ExpansionType.None) { return(ExpansionControl.Skip); } return(ExpansionControl.Continue); }, (ExpansionFailure failure, ADRawEntry member, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentExpansionType) => ExpansionControl.Continue); }, groupDN); if (!adoperationResult.Succeeded) { return; } MultiValuedProperty <ADObjectId> multiValuedProperty = group[ADRecipientSchema.MemberOfGroup] as MultiValuedProperty <ADObjectId>; foreach (ADObjectId adobjectId in multiValuedProperty) { string distinguishedName = adobjectId.DistinguishedName; if (!parentGroupDictionary.ContainsKey(distinguishedName)) { parentGroupDictionary.Add(distinguishedName, null); parentGroupList.Add(distinguishedName); } } int count = allMemberHashes.Count; calculatedGroups.Add(hash); this.groupsExpanded++; int oldValue = (int)group[ADGroupSchema.GroupMemberCount]; int oldValue2 = (int)group[ADGroupSchema.GroupExternalMemberCount]; if (this.ShouldSaveToAD(oldValue, count) || this.ShouldSaveToAD(oldValue2, externalMemberCount)) { this.SaveGroupMetricsToAD(session, group, count, externalMemberCount); } }