protected override void WriteResult() { TaskLogger.LogEnter(new object[] { this.DataObject.Id }); RemoteMailbox sendToPipeline = new RemoteMailbox(this.DataObject); base.WriteObject(sendToPipeline); TaskLogger.LogExit(); }
protected override void WriteResult(ADObject result) { TaskLogger.LogEnter(new object[] { result.Identity }); RemoteMailbox result2 = new RemoteMailbox((ADUser)result); base.WriteResult(result2); TaskLogger.LogExit(); }
public static void GetRemoteMailboxPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow row = dataTable.Rows[0]; RemoteMailbox remoteMailbox = store.GetDataObject("RemoteMailbox") as RemoteMailbox; if (remoteMailbox != null) { MailboxPropertiesHelper.TrySetColumnValue(row, "MailboxCanHaveArchive", remoteMailbox.ExchangeVersion.CompareTo(ExchangeObjectVersion.Exchange2010) >= 0 && (remoteMailbox.RecipientTypeDetails == (RecipientTypeDetails)((ulong)int.MinValue) || remoteMailbox.RecipientTypeDetails == RecipientTypeDetails.RemoteRoomMailbox || remoteMailbox.RecipientTypeDetails == RecipientTypeDetails.RemoteEquipmentMailbox || remoteMailbox.RecipientTypeDetails == RecipientTypeDetails.RemoteSharedMailbox)); MailboxPropertiesHelper.TrySetColumnValue(row, "EnableArchive", remoteMailbox.ArchiveState != ArchiveState.None); MailboxPropertiesHelper.TrySetColumnValue(row, "HasArchive", remoteMailbox.ArchiveState != ArchiveState.None); MailboxPropertiesHelper.TrySetColumnValue(row, "RemoteArchive", remoteMailbox.ArchiveState == ArchiveState.HostedProvisioned || remoteMailbox.ArchiveState == ArchiveState.HostedPending); } }
// Token: 0x06000172 RID: 370 RVA: 0x0000A128 File Offset: 0x00008328 private static SmtpAddress GetDiscoveryHolds(DiscoverySearchDataProvider dataProvider, Dictionary <string, MailboxDiscoverySearch> discoveryHolds) { SmtpAddress smtpAddress = SmtpAddress.Empty; ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), OrganizationId.ForestWideOrgId, null, false); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 324, "GetDiscoveryHolds", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\elc\\DiscoveryHoldSynchronizer.cs"); foreach (MailboxDiscoverySearch mailboxDiscoverySearch in dataProvider.GetAll <MailboxDiscoverySearch>()) { if (mailboxDiscoverySearch.InPlaceHoldEnabled) { discoveryHolds.Add(mailboxDiscoverySearch.InPlaceHoldIdentity, mailboxDiscoverySearch); if (smtpAddress == SmtpAddress.Empty) { Result <ADRawEntry>[] first = tenantOrRootOrgRecipientSession.FindByLegacyExchangeDNs(mailboxDiscoverySearch.Sources.ToArray(), new ADPropertyDefinition[] { ADRecipientSchema.RecipientType, ADRecipientSchema.RecipientTypeDetails, ADUserSchema.ArchiveDomain, ADUserSchema.ArchiveGuid, ADRecipientSchema.RawExternalEmailAddress, ADUserSchema.ArchiveStatus }); foreach (ADRawEntry adrawEntry in from x in first select x.Data) { if (adrawEntry != null) { RecipientType recipientType = (RecipientType)adrawEntry[ADRecipientSchema.RecipientType]; RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)adrawEntry[ADRecipientSchema.RecipientTypeDetails]; SmtpDomain smtpDomain = (SmtpDomain)adrawEntry[ADUserSchema.ArchiveDomain]; ArchiveStatusFlags archiveStatusFlags = (ArchiveStatusFlags)adrawEntry[ADUserSchema.ArchiveStatus]; if (RemoteMailbox.IsRemoteMailbox(recipientTypeDetails)) { smtpAddress = new SmtpAddress(((ProxyAddress)adrawEntry[ADRecipientSchema.RawExternalEmailAddress]).AddressString); } else if (recipientType == RecipientType.UserMailbox && smtpDomain != null && !string.IsNullOrEmpty(smtpDomain.Domain) && (archiveStatusFlags & ArchiveStatusFlags.Active) == ArchiveStatusFlags.Active) { Guid guid = (Guid)adrawEntry[ADUserSchema.ArchiveGuid]; if (guid != Guid.Empty) { smtpAddress = new SmtpAddress(SmtpProxyAddress.EncapsulateExchangeGuid(smtpDomain.Domain, guid)); } } } } } } } return(smtpAddress); }
private ADObjectId ADObjectIdFromRecipientIdParameter(RecipientIdParameter recipientId, object param) { ADRecipient adrecipient = base.GetDataObject <ADRecipient>(recipientId, this.recipientSession, null, new LocalizedString?(Strings.ExceptionUserObjectNotFound(recipientId.ToString())), new LocalizedString?(Strings.ExceptionUserObjectAmbiguous)) as ADRecipient; if (param != null) { RecipientType[] array = param as RecipientType[]; foreach (RecipientType recipientType in array) { if (adrecipient.RecipientType == recipientType || RemoteMailbox.IsRemoteMailbox(adrecipient.RecipientTypeDetails)) { return(adrecipient.Id); } } base.WriteError(new MailboxSearchTaskException(Strings.ErrorInvalidRecipientType(adrecipient.ToString(), adrecipient.RecipientType.ToString())), ErrorCategory.InvalidArgument, null); } return(adrecipient.Id); }
protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject) { return(RemoteMailbox.FromDataObject((ADUser)dataObject)); }
protected override void PrepareRecipientObject(ref ADUser user) { TaskLogger.LogEnter(); base.PrepareRecipientObject(ref user); if ("EnabledUser" == base.ParameterSetName || "Room" == base.ParameterSetName || "Equipment" == base.ParameterSetName || "Shared" == base.ParameterSetName) { if (RemoteMailbox.IsRemoteMailbox(user.RecipientTypeDetails)) { base.WriteError(new RecipientTaskException(Strings.ErrorInvalidRecipientType(user.Identity.ToString(), user.RecipientTypeDetails.ToString())), ErrorCategory.InvalidArgument, user.Id); } if (null == this.RemoteRoutingAddress) { if (user.RecipientType == RecipientType.User) { if (this.remoteRoutingAddressGenerator == null) { this.remoteRoutingAddressGenerator = new RemoteRoutingAddressGenerator(this.ConfigurationSession); } user.ExternalEmailAddress = this.remoteRoutingAddressGenerator.GenerateRemoteRoutingAddress(user.Alias, new Task.ErrorLoggerDelegate(base.WriteError)); } } else { user.ExternalEmailAddress = this.RemoteRoutingAddress; } user.RemoteRecipientType = RemoteRecipientType.ProvisionMailbox; RemoteMailboxType remoteMailboxType = (RemoteMailboxType)((ulong)int.MinValue); if (this.Room.IsPresent) { remoteMailboxType = RemoteMailboxType.Room; } else if (this.Equipment.IsPresent) { remoteMailboxType = RemoteMailboxType.Equipment; } else if (this.Shared.IsPresent) { remoteMailboxType = RemoteMailboxType.Shared; } user.UpdateRemoteMailboxType(remoteMailboxType, this.ACLableSyncedObjectEnabled); user.SetExchangeVersion(ExchangeObjectVersion.Current); } if ("Archive" == base.ParameterSetName) { if (!RemoteMailbox.IsRemoteMailbox(user.RecipientTypeDetails)) { base.WriteError(new RecipientTaskException(Strings.ErrorInvalidRecipientType(user.Identity.ToString(), user.RecipientTypeDetails.ToString())), ErrorCategory.InvalidArgument, user.Id); } if ((user.RemoteRecipientType & RemoteRecipientType.ProvisionArchive) != RemoteRecipientType.ProvisionArchive) { if (user.ArchiveGuid == Guid.Empty) { if (user.DisabledArchiveGuid != Guid.Empty) { user.ArchiveGuid = user.DisabledArchiveGuid; } else { user.ArchiveGuid = Guid.NewGuid(); } } if (this.ArchiveName == null) { if (user.ArchiveName == null || user.ArchiveName.Count == 0) { user.ArchiveName = new MultiValuedProperty <string>(Strings.ArchiveNamePrefix + user.DisplayName); } } else { user.ArchiveName = this.ArchiveName; } user.RemoteRecipientType = ((user.RemoteRecipientType &= ~RemoteRecipientType.DeprovisionArchive) | RemoteRecipientType.ProvisionArchive); TaskLogger.LogExit(); return; } base.WriteError(new RecipientTaskException(Strings.ErrorArchiveAlreadyPresent(this.Identity.ToString())), (ErrorCategory)1003, null); } TaskLogger.LogExit(); }
protected void ResolveRequestedADRecipient() { string resolveMethod = "Unknown"; try { if (this.Caller != null) { if (!string.IsNullOrEmpty(this.RequestData.LegacyDN) && string.Equals(this.Caller.LegacyExchangeDN, this.RequestData.LegacyDN, StringComparison.OrdinalIgnoreCase)) { this.RequestedRecipient = this.Caller; resolveMethod = "CallerByLegacyDN"; return; } if (!string.IsNullOrEmpty(this.RequestData.LegacyDN) && this.Caller.EmailAddresses != null) { string x500 = "x500:" + this.RequestData.LegacyDN; ProxyAddress a = this.Caller.EmailAddresses.Find((ProxyAddress x) => string.Equals(x.ToString(), x500, StringComparison.OrdinalIgnoreCase)); if (a != null) { this.RequestedRecipient = this.Caller; resolveMethod = "CallerByX500"; return; } } if (!string.IsNullOrEmpty(this.RequestData.EMailAddress) && SmtpAddress.IsValidSmtpAddress(this.RequestData.EMailAddress)) { SmtpProxyAddress smtpProxy = new SmtpProxyAddress(this.RequestData.EMailAddress, true); ProxyAddress a2 = this.Caller.EmailAddresses.Find((ProxyAddress x) => x.Equals(smtpProxy)); if (a2 != null) { this.RequestedRecipient = this.Caller; resolveMethod = "CallerByProxy"; return; } } if (AutodiscoverCommonUserSettings.HasLocalArchive(this.Caller) && AutodiscoverCommonUserSettings.IsEmailAddressTargetingArchive(this.Caller as ADUser, this.RequestData.EMailAddress)) { this.RequestedRecipient = this.Caller; resolveMethod = "CallerByArchive"; return; } } if (this.Caller == null) { if (VariantConfiguration.InvariantNoFlightingSnapshot.Autodiscover.NoADLookupForUser.Enabled) { goto IL_285; } } try { RequestDetailsLoggerBase <RequestDetailsLogger> .Current.TrackLatency(ServiceLatencyMetadata.RequestedUserADLatency, delegate() { IRecipientSession callerScopedRecipientSession = this.GetCallerScopedRecipientSession(); if (!string.IsNullOrEmpty(this.RequestData.LegacyDN)) { this.RequestedRecipient = callerScopedRecipientSession.FindByLegacyExchangeDN(this.RequestData.LegacyDN); if (this.RequestedRecipient != null) { resolveMethod = "FoundByLegacyDN"; } } if (this.RequestedRecipient == null && this.RequestData.EMailAddress != null && SmtpAddress.IsValidSmtpAddress(this.RequestData.EMailAddress)) { Guid guid; if (AutodiscoverCommonUserSettings.TryGetExchangeGuidFromEmailAddress(this.RequestData.EMailAddress, out guid)) { this.RequestedRecipient = callerScopedRecipientSession.FindByExchangeGuidIncludingArchive(guid); ADUser aduser = this.RequestedRecipient as ADUser; if (aduser != null && aduser.ArchiveGuid.Equals(guid) && RemoteMailbox.IsRemoteMailbox(aduser.RecipientTypeDetails) && aduser.ArchiveDatabase == null) { this.RequestedRecipient = null; } if (this.RequestedRecipient != null) { resolveMethod = "FoundByGUID"; } } if (this.RequestedRecipient == null) { SmtpProxyAddress proxyAddress = new SmtpProxyAddress(this.RequestData.EMailAddress, true); this.RequestedRecipient = callerScopedRecipientSession.FindByProxyAddress(proxyAddress); if (this.RequestedRecipient != null) { resolveMethod = "FoundBySMTP"; } } } }); } catch (LocalizedException ex) { ExTraceGlobals.FrameworkTracer.TraceError <string, string>(0L, "[UpdateCacheCallback()] 'LocalizedException' Message=\"{0}\";StackTrace=\"{1}\"", ex.Message, ex.StackTrace); Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrWebException, Common.PeriodicKey, new object[] { ex.Message, ex.StackTrace }); resolveMethod = "Exception"; } IL_285 :; } finally { RequestDetailsLoggerBase <RequestDetailsLogger> .Current.AppendGenericInfo("ResolveMethod", resolveMethod); } }
// Token: 0x06000DAD RID: 3501 RVA: 0x00028DAE File Offset: 0x00026FAE public RemoteMailboxIdParameter(RemoteMailbox remoteMailbox) : base(remoteMailbox.Id) { }
internal static MultiValuedProperty <string> ConvertSourceMailboxesCollection(IEnumerable <RecipientIdParameter> recipientIds, bool inplaceHoldEnabled, Func <RecipientIdParameter, ADRecipient> recipientGetter, IRecipientSession recipientSession, Task.TaskErrorLoggingDelegate writeErrorDelegate, Action <LocalizedString> writeWarningDelegate, Func <LocalizedString, bool> shouldContinueDelegate) { MultiValuedProperty <string> results = null; if (recipientIds != null) { RecipientType[] source = new RecipientType[] { RecipientType.UserMailbox, RecipientType.Group, RecipientType.MailUniversalDistributionGroup, RecipientType.MailUniversalSecurityGroup, RecipientType.MailNonUniversalGroup, RecipientType.DynamicDistributionGroup }; bool flag = false; foreach (RecipientIdParameter arg in recipientIds) { if (results == null) { results = new MultiValuedProperty <string>(); } ADRecipient adrecipient = recipientGetter(arg); string text = null; ADSessionSettings sessionSettings = adrecipient.OrganizationId.ToADSessionSettings(); if (Utils.IsPublicFolderMailbox(adrecipient)) { writeErrorDelegate(new MailboxSearchTaskException(Strings.ErrorInvalidRecipientTypeDetails(adrecipient.ToString())), ErrorCategory.InvalidArgument, null); } else if (Utils.IsValidMailboxType(adrecipient)) { if (adrecipient.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012) && !RemoteMailbox.IsRemoteMailbox(adrecipient.RecipientTypeDetails) && ExchangePrincipal.FromADUser(sessionSettings, (ADUser)adrecipient, RemotingOptions.AllowCrossSite).MailboxInfo.Location.ServerVersion < Server.E15MinVersion) { writeErrorDelegate(new MailboxSearchTaskException(Strings.SourceMailboxMustBeE15OrLater(adrecipient.DisplayName)), ErrorCategory.InvalidArgument, null); } text = adrecipient.LegacyExchangeDN; } else if (source.Contains(adrecipient.RecipientType)) { if (inplaceHoldEnabled) { if (!flag) { if (shouldContinueDelegate(Strings.ShouldContinueToExpandGroupsForHold)) { flag = true; } else { writeErrorDelegate(new MailboxSearchTaskException(Strings.GroupsIsNotAllowedForHold(adrecipient.DisplayName)), ErrorCategory.InvalidArgument, null); } } bool invalidTypeSkipped = false; bool oldVersionMailboxSkipped = false; ADRecipientExpansion adrecipientExpansion = new ADRecipientExpansion(new PropertyDefinition[] { ADRecipientSchema.LegacyExchangeDN, ADRecipientSchema.RecipientTypeDetailsValue, ADObjectSchema.ExchangeVersion }, adrecipient.OrganizationId); adrecipientExpansion.Expand(adrecipient, delegate(ADRawEntry expandedRecipient, ExpansionType expansionType, ADRawEntry parent, ExpansionType parentType) { if (expansionType == ExpansionType.GroupMembership) { return(ExpansionControl.Continue); } if (Utils.IsValidMailboxType(expandedRecipient)) { ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)expandedRecipient[ADObjectSchema.ExchangeVersion]; string text2 = (string)expandedRecipient[ADRecipientSchema.LegacyExchangeDN]; if (!oldVersionMailboxSkipped && exchangeObjectVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012) && !RemoteMailbox.IsRemoteMailbox((RecipientTypeDetails)expandedRecipient[ADRecipientSchema.RecipientTypeDetails]) && ExchangePrincipal.FromLegacyDN(sessionSettings, text2).MailboxInfo.Location.ServerVersion < Server.E15MinVersion) { oldVersionMailboxSkipped = true; writeWarningDelegate(Strings.OldVersionMailboxSkipped); } if (!results.Contains(text2)) { results.Add(text2); } } else if (!invalidTypeSkipped) { invalidTypeSkipped = true; writeWarningDelegate(Strings.SkippingInvalidTypeInGroupExpansion); } return(ExpansionControl.Skip); }, delegate(ExpansionFailure failure, ADRawEntry expandedRecipient, ExpansionType expansionType, ADRawEntry parent, ExpansionType parentType) { TaskLogger.Trace("Skipping invalid AD entry {0} because of failure: {1}", new object[] { expandedRecipient, failure }); return(ExpansionControl.Skip); }); } else { text = adrecipient.LegacyExchangeDN; } } else { writeErrorDelegate(new MailboxSearchTaskException(Strings.ErrorInvalidRecipientType(adrecipient.ToString(), adrecipient.RecipientType.ToString())), ErrorCategory.InvalidArgument, null); } if (text != null && !results.Contains(text)) { results.Add(text); } if (results.Count > Utils.MaxNumberOfMailboxesInSingleHold) { writeErrorDelegate(new MailboxSearchTaskException(Strings.ErrorTooManyMailboxesInSingleHold(Utils.MaxNumberOfMailboxesInSingleHold)), ErrorCategory.InvalidArgument, null); } } if (results != null) { uint discoveryMaxMailboxes = SearchUtils.GetDiscoveryMaxMailboxes(recipientSession); if ((long)results.Count > (long)((ulong)discoveryMaxMailboxes) && !shouldContinueDelegate(Strings.ShouldContinueMoreMailboxesThanMaxSearch(results.Count, discoveryMaxMailboxes))) { writeErrorDelegate(new MailboxSearchTaskException(Strings.ErrorTaskCancelledBecauseMoreMailboxesThanSearchSupported), ErrorCategory.InvalidArgument, null); } } } return(results); }
internal static bool IsValidMailboxType(ADRawEntry recipient) { return((RecipientType)recipient[ADRecipientSchema.RecipientType] == RecipientType.UserMailbox || RemoteMailbox.IsRemoteMailbox((RecipientTypeDetails)recipient[ADRecipientSchema.RecipientTypeDetails])); }