// Token: 0x0600588E RID: 22670 RVA: 0x0013ABE9 File Offset: 0x00138DE9
 internal static MailPublicFolder FromDataObject(ADPublicFolder dataObject)
 {
     if (dataObject == null)
     {
         return(null);
     }
     return(new MailPublicFolder(dataObject));
 }
示例#2
0
        private void ValidateAndUpdateMailPublicFolderParameters()
        {
            if (this.MailRecipientGuid == null && this.MailEnabled == null)
            {
                return;
            }
            Guid?mailRecipientGuid = this.MailRecipientGuid;
            Guid?guid = (mailRecipientGuid != null) ? new Guid?(mailRecipientGuid.GetValueOrDefault()) : this.DataObject.MailRecipientGuid;
            bool flag = this.MailEnabled ?? this.DataObject.MailEnabled;

            if (this.MailRecipientGuid != null && !flag)
            {
                base.WriteError(new ArgumentException(Strings.ErrorSetPublicFolderMailMailEnabledFalse), ErrorCategory.InvalidArgument, this.Identity);
            }
            if (this.MailEnabled != null && this.MailEnabled.Value && guid == null)
            {
                base.WriteError(new ArgumentException(Strings.ErrorSetPublicFolderMailMailRecipientGuidNull), ErrorCategory.InvalidArgument, this.Identity);
            }
            if (this.MailEnabled != null && !this.MailEnabled.Value)
            {
                this.DataObject.MailEnabled = false;
                this.DataObject.ProxyGuid   = null;
                return;
            }
            if (this.MailRecipientGuid != null || (this.MailEnabled != null && this.MailEnabled.Value))
            {
                ADObjectId     identity       = new ADObjectId(guid.Value);
                ADPublicFolder adpublicFolder = this.RecipientSession.Read <ADPublicFolder>(identity) as ADPublicFolder;
                if (adpublicFolder == null)
                {
                    base.WriteError(new ObjectNotFoundException(Strings.ErrorSetPublicFolderMailRecipientGuidNotFoundInAd(guid.Value.ToString())), ErrorCategory.InvalidData, this.Identity);
                }
                StoreObjectId storeObjectId  = StoreObjectId.FromHexEntryId(adpublicFolder.EntryId);
                StoreObjectId storeObjectId2 = StoreObjectId.FromHexEntryId(this.DataObject.EntryId);
                if (!ArrayComparer <byte> .Comparer.Equals(storeObjectId.LongTermFolderId, storeObjectId2.LongTermFolderId))
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorSetPublicFolderMailRecipientGuidLongTermIdNotMatch(adpublicFolder.Id.ToString())), ErrorCategory.InvalidData, this.Identity);
                }
                if (this.DataObject.MailRecipientGuid == null || this.DataObject.MailRecipientGuid.Value != guid.Value)
                {
                    this.DataObject.MailRecipientGuid = new Guid?(guid.Value);
                }
                if (!this.DataObject.MailEnabled)
                {
                    this.DataObject.MailEnabled = true;
                }
            }
        }
 // Token: 0x0600588D RID: 22669 RVA: 0x0013ABE0 File Offset: 0x00138DE0
 public MailPublicFolder(ADPublicFolder dataObject) : base(dataObject)
 {
 }
示例#4
0
        // Token: 0x060003B5 RID: 949 RVA: 0x00015440 File Offset: 0x00013640
        internal static ADObject CreateAndInitializeRecipientObject <TRecipientObject>(ADPropertyBag propertyBag, ADRawEntry dummyObject, IRecipientSession recipientSession) where TRecipientObject : IConfigurable, new()
        {
            ArgumentValidator.ThrowIfNull("propertyBag", propertyBag);
            ArgumentValidator.ThrowIfNull("dummyObject", dummyObject);
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADObjectSchema.ObjectClass];
            ADObject adobject;

            if (dummyObject is OWAMiniRecipient)
            {
                adobject = new OWAMiniRecipient();
            }
            else if (dummyObject is ActiveSyncMiniRecipient)
            {
                adobject = new ActiveSyncMiniRecipient();
            }
            else if (dummyObject is StorageMiniRecipient)
            {
                adobject = new StorageMiniRecipient();
            }
            else if (dummyObject is TransportMiniRecipient)
            {
                adobject = new TransportMiniRecipient();
            }
            else if (dummyObject is LoadBalancingMiniRecipient)
            {
                adobject = new LoadBalancingMiniRecipient();
            }
            else if (dummyObject is MiniRecipientWithTokenGroups)
            {
                adobject = new MiniRecipientWithTokenGroups();
            }
            else if (dummyObject is FrontEndMiniRecipient)
            {
                adobject = new FrontEndMiniRecipient();
            }
            else if (dummyObject is MiniRecipient)
            {
                adobject = new MiniRecipient();
            }
            else if (dummyObject is RemovedMailbox)
            {
                adobject = new RemovedMailbox();
            }
            else if (dummyObject is DeletedRecipient)
            {
                adobject = new DeletedRecipient();
            }
            else if (multiValuedProperty.Contains(ADComputerRecipient.MostDerivedClass))
            {
                adobject = new ADComputerRecipient();
            }
            else if (multiValuedProperty.Contains(ADUser.MostDerivedClass))
            {
                adobject = new ADUser();
            }
            else if (multiValuedProperty.Contains(ADContact.MostDerivedClass))
            {
                adobject = new ADContact();
            }
            else if (multiValuedProperty.Contains(ADGroup.MostDerivedClass))
            {
                adobject = new ADGroup();
            }
            else if (multiValuedProperty.Contains(ADDynamicGroup.MostDerivedClass))
            {
                adobject = new ADDynamicGroup();
            }
            else if (multiValuedProperty.Contains(ADPublicFolder.MostDerivedClass))
            {
                adobject = new ADPublicFolder();
            }
            else if (multiValuedProperty.Contains(ADSystemAttendantMailbox.MostDerivedClass))
            {
                adobject = new ADSystemAttendantMailbox();
            }
            else if (multiValuedProperty.Contains(ADSystemMailbox.MostDerivedClass))
            {
                adobject = new ADSystemMailbox();
            }
            else if (multiValuedProperty.Contains(ADPublicDatabase.MostDerivedClass))
            {
                adobject = new ADPublicDatabase();
            }
            else
            {
                if (!multiValuedProperty.Contains(ADMicrosoftExchangeRecipient.MostDerivedClass))
                {
                    string objectClass = string.Empty;
                    foreach (string text in multiValuedProperty)
                    {
                        objectClass = text;
                    }
                    ObjectValidationError error = new ObjectValidationError(DirectoryStrings.UnsupportedObjectClass(objectClass), (ADObjectId)propertyBag[ADObjectSchema.Id], string.Empty);
                    ADProviderPerf.UpdateProcessCounter(Counter.ProcessRateCriticalValidationFailures, UpdateType.Update, 1U);
                    Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_VALIDATION_FAILED_FCO_MODE_RECIPIENT, ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToString(), new object[]
                    {
                        ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToDNString()
                    });
                    throw new DataValidationException(error);
                }
                adobject = new ADMicrosoftExchangeRecipient();
            }
            adobject.m_Session   = recipientSession;
            adobject.propertyBag = propertyBag;
            adobject.Initialize();
            adobject.ResetChangeTracking(true);
            if (recipientSession != null)
            {
                adobject.SetIsReadOnly(recipientSession.ReadOnly);
            }
            ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, RecipientType>((long)((recipientSession != null) ? recipientSession.GetHashCode() : 0), "ADRecipientObjectSession::CreateObject - Got {0} as {1}", adobject.DistinguishedName, (RecipientType)adobject[ADRecipientSchema.RecipientType]);
            return(adobject);
        }
示例#5
0
        private Guid LinkMailPublicFolder(LinkMailPublicFolderFlags flags, byte[] objectId, Guid contentMailboxGuid, byte[] sourceFolderEntryId)
        {
            Guid result = Guid.Empty;

            try
            {
                ADObjectId contentMailbox = null;
                if (!this.mailboxToADObjectIdMap.TryGetValue(contentMailboxGuid, out contentMailbox))
                {
                    ADUser aduser = this.orgRecipientSession.FindByExchangeGuid(contentMailboxGuid) as ADUser;
                    if (aduser == null)
                    {
                        throw new RecipientNotFoundPermanentException(contentMailboxGuid);
                    }
                    this.mailboxToADObjectIdMap[contentMailboxGuid] = aduser.Id;
                    contentMailbox = aduser.Id;
                }
                ADPublicFolder adpublicFolder = null;
                switch (flags)
                {
                case LinkMailPublicFolderFlags.ObjectGuid:
                    adpublicFolder = (this.orgRecipientSession.Read(new ADObjectId(objectId)) as ADPublicFolder);
                    if (adpublicFolder == null)
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithObjectIdNotFound(new Guid(objectId)))));
                    }
                    break;

                case LinkMailPublicFolderFlags.EntryId:
                {
                    string        text  = PublicFolderSession.ConvertToLegacyDN("e71f13d1-0178-42a7-8c47-24206de84a77", HexConverter.ByteArrayToHexString(objectId));
                    ADRecipient[] array = this.orgRecipientSession.Find(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.LegacyExchangeDN, text), null, 2);
                    if (array.Length == 1)
                    {
                        adpublicFolder = (array[0] as ADPublicFolder);
                    }
                    else if (array.Length > 1)
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithMultipleEntriesFound(text))));
                    }
                    else
                    {
                        base.Report.Append(new ReportEntry(MrsStrings.MoveRequestMessageWarning(MrsStrings.MailPublicFolderWithLegacyExchangeDnNotFound(text))));
                    }
                    break;
                }

                default:
                    throw new UnexpectedErrorPermanentException(-2147024809);
                }
                if (adpublicFolder != null)
                {
                    adpublicFolder.ContentMailbox = contentMailbox;
                    adpublicFolder.EntryId        = HexConverter.ByteArrayToHexString(base.DestMailbox.GetSessionSpecificEntryId(sourceFolderEntryId));
                    this.orgRecipientSession.Save(adpublicFolder);
                    result = adpublicFolder.Guid;
                }
            }
            catch (LocalizedException ex)
            {
                base.Report.Append(new ReportEntry(new LocalizedString(ex.Message)));
                throw;
            }
            return(result);
        }