コード例 #1
0
        protected override MailboxAssociation CreateMailboxAssociationFromItem(IPropertyBag item, bool setExtendedProperties = false)
        {
            GroupMailboxLocator         group = new GroupMailboxLocator(base.AdSession, base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.ExternalId, string.Empty), base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.LegacyDN, string.Empty));
            MailboxAssociationFromStore mailboxAssociationFromStore = new MailboxAssociationFromStore
            {
                User               = (base.MasterLocator as UserMailboxLocator),
                Group              = group,
                ItemId             = base.AssociationStore.GetValueOrDefault <VersionedId>(item, ItemSchema.Id, null),
                IsPin              = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsPin, false),
                IsMember           = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsMember, false),
                JoinDate           = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationBaseSchema.JoinDate, default(ExDateTime)),
                PinDate            = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationGroupSchema.PinDate, default(ExDateTime)),
                LastModified       = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, StoreObjectSchema.LastModifiedTime, default(ExDateTime)),
                SyncedVersion      = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.SyncedVersion, 0),
                CurrentVersion     = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.CurrentVersion, 0),
                SyncedIdentityHash = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.SyncedIdentityHash, null)
            };

            if (setExtendedProperties)
            {
                mailboxAssociationFromStore.SyncAttempts        = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.SyncAttempts, 0);
                mailboxAssociationFromStore.SyncedSchemaVersion = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.SyncedSchemaVersion, string.Empty);
                mailboxAssociationFromStore.LastSyncError       = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.LastSyncError, string.Empty);
            }
            this.Tracer.TraceDebug <bool, MailboxAssociationFromStore>((long)this.GetHashCode(), "GroupAssociationAdaptor.CreateMailboxAssociationFromItem: Creating association from information found in store item. SetExtendedProperties={0}, Association={1}", setExtendedProperties, mailboxAssociationFromStore);
            return(mailboxAssociationFromStore);
        }
コード例 #2
0
        protected override MailboxAssociation CreateMailboxAssociationFromItem(IPropertyBag item, bool setExtendedProperties = false)
        {
            UserMailboxLocator          user           = new UserMailboxLocator(base.AdSession, base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.ExternalId, string.Empty), base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.LegacyDN, string.Empty));
            string                      valueOrDefault = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.SmtpAddress, null);
            MailboxAssociationFromStore mailboxAssociationFromStore = new MailboxAssociationFromStore
            {
                User               = user,
                Group              = (base.MasterLocator as GroupMailboxLocator),
                ItemId             = base.AssociationStore.GetValueOrDefault <VersionedId>(item, ItemSchema.Id, null),
                UserSmtpAddress    = (string.IsNullOrEmpty(valueOrDefault) ? SmtpAddress.Empty : new SmtpAddress(valueOrDefault)),
                IsMember           = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsMember, false),
                ShouldEscalate     = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.ShouldEscalate, false),
                IsAutoSubscribed   = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsAutoSubscribed, false),
                IsPin              = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsPin, false),
                JoinDate           = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationBaseSchema.JoinDate, default(ExDateTime)),
                LastVisitedDate    = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationUserSchema.LastVisitedDate, default(ExDateTime)),
                LastModified       = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, StoreObjectSchema.LastModifiedTime, default(ExDateTime)),
                SyncedVersion      = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.SyncedVersion, 0),
                CurrentVersion     = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.CurrentVersion, 0),
                SyncedIdentityHash = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.SyncedIdentityHash, null)
            };

            if (setExtendedProperties)
            {
                mailboxAssociationFromStore.JoinedBy            = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationUserSchema.JoinedBy, string.Empty);
                mailboxAssociationFromStore.SyncAttempts        = base.AssociationStore.GetValueOrDefault <int>(item, MailboxAssociationBaseSchema.SyncAttempts, 0);
                mailboxAssociationFromStore.SyncedSchemaVersion = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.SyncedSchemaVersion, string.Empty);
                mailboxAssociationFromStore.LastSyncError       = base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.LastSyncError, string.Empty);
            }
            this.Tracer.TraceDebug <bool, MailboxAssociationFromStore>((long)this.GetHashCode(), "UserAssociationAdaptor.CreateMailboxAssociationFromItem: Creating association from information found in store item. SetExtendedProperties={0}, Association={1}", setExtendedProperties, mailboxAssociationFromStore);
            return(mailboxAssociationFromStore);
        }
コード例 #3
0
        protected override MailboxAssociation CreateMailboxAssociationFromItem(IPropertyBag item, bool setExtendedProperties = false)
        {
            UserMailboxLocator          user = new UserMailboxLocator(base.AdSession, base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.ExternalId, string.Empty), base.AssociationStore.GetValueOrDefault <string>(item, MailboxAssociationBaseSchema.LegacyDN, string.Empty));
            MailboxAssociationFromStore mailboxAssociationFromStore = new MailboxAssociationFromStore
            {
                User            = user,
                Group           = (base.MasterLocator as GroupMailboxLocator),
                IsMember        = base.AssociationStore.GetValueOrDefault <bool>(item, MailboxAssociationBaseSchema.IsMember, false),
                JoinDate        = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationBaseSchema.JoinDate, default(ExDateTime)),
                LastVisitedDate = base.AssociationStore.GetValueOrDefault <ExDateTime>(item, MailboxAssociationUserSchema.LastVisitedDate, default(ExDateTime))
            };

            this.Tracer.TraceDebug <bool, MailboxAssociationFromStore>((long)this.GetHashCode(), "UnseenDataUserAssociationAdaptor .CreateMailboxAssociationFromItem: Creating association from information found in store item. SetExtendedProperties={0}, Association={1}", setExtendedProperties, mailboxAssociationFromStore);
            return(mailboxAssociationFromStore);
        }
コード例 #4
0
        protected IMailboxAssociationBaseItem ReadOrCreateMailboxItem(MailboxAssociation mailboxAssociation)
        {
            MailboxAssociationFromStore mailboxAssociationFromStore = mailboxAssociation as MailboxAssociationFromStore;

            if (mailboxAssociationFromStore != null)
            {
                this.Tracer.TraceDebug <VersionedId>((long)this.GetHashCode(), "BaseAssociationAdaptor.ReadOrCreateMailboxItem. Binding item using entry id found in property bag. Id = {0}", mailboxAssociationFromStore.ItemId);
                IMailboxAssociationBaseItem associationByItemId = this.GetAssociationByItemId(mailboxAssociationFromStore.ItemId);
                this.associationStore.OpenAssociationAsReadWrite(associationByItemId);
                return(associationByItemId);
            }
            this.Tracer.TraceDebug((long)this.GetHashCode(), "BaseAssociationAdaptor.ReadOrCreateMailboxItem. MailboxAssociation was not instantiated from store item, querying store");
            MailboxLocator slaveMailboxLocator = this.GetSlaveMailboxLocator(mailboxAssociation);

            return(this.ReadOrCreateMailboxItem(slaveMailboxLocator));
        }
コード例 #5
0
        public void DeleteAssociation(MailboxAssociation association)
        {
            MailboxAssociationFromStore mailboxAssociationFromStore = association as MailboxAssociationFromStore;
            IMailboxAssociationBaseItem mailboxAssociationBaseItem;

            if (mailboxAssociationFromStore != null)
            {
                this.Tracer.TraceDebug <VersionedId, MailboxAssociationFromStore>((long)this.GetHashCode(), "BaseAssociationAdaptor.DeleteAssociation: Found MailboxAssociationFromStore querying store by ItemId. ItemId={0}. Association={1}.", mailboxAssociationFromStore.ItemId, mailboxAssociationFromStore);
                mailboxAssociationBaseItem = this.GetAssociationByItemId(mailboxAssociationFromStore.ItemId);
            }
            else
            {
                IMailboxLocator slaveMailboxLocator = this.GetSlaveMailboxLocator(association);
                this.Tracer.TraceDebug <IMailboxLocator, MailboxAssociation>((long)this.GetHashCode(), "BaseAssociationAdaptor.DeleteAssociation: Found in memory MailboxAssociation, querying store by slave locator. Slave Locator={0}. Association={1}.", slaveMailboxLocator, association);
                mailboxAssociationBaseItem = this.GetItemFromStore(slaveMailboxLocator);
            }
            if (mailboxAssociationBaseItem != null)
            {
                this.Tracer.TraceDebug((long)this.GetHashCode(), "BaseAssociationAdaptor.DeleteAssociation: Association item found in store, Deleting.");
                this.associationStore.DeleteAssociation(mailboxAssociationBaseItem);
                return;
            }
            this.Tracer.TraceDebug((long)this.GetHashCode(), "BaseAssociationAdaptor.DeleteAssociation: Association item not found. No action needed.");
        }