private void UpdateMailboxAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor, ADUser masterMailbox, IExtensibleLogger logger)
        {
            if (association == null)
            {
                SetMailboxAssociation.Tracer.TraceDebug((long)this.GetHashCode(), "SetMailboxAssocaition.UpdateMailboxAssociation. Skipping null MailboxAssociationFromStore.");
                return;
            }
            bool flag = this.Instance.UpdateAssociation(association, associationAdaptor);

            associationAdaptor.SaveAssociation(association, this.ReplicateMasteredData);
            if (this.UpdateSlavedData)
            {
                associationAdaptor.ReplicateAssociation(association);
            }
            if (flag)
            {
                associationAdaptor.SaveSyncState(association);
            }
            if (this.ReplicateMasteredData)
            {
                RpcAssociationReplicator rpcAssociationReplicator = new RpcAssociationReplicator(logger, associationAdaptor.AssociationStore.ServerFullyQualifiedDomainName);
                rpcAssociationReplicator.ReplicateAssociation(associationAdaptor, new MailboxAssociation[]
                {
                    association
                });
            }
        }
 private void DeleteMailboxAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor, ADUser masterMailbox, IExtensibleLogger logger)
 {
     if (association != null)
     {
         associationAdaptor.DeleteAssociation(association);
         return;
     }
     base.WriteError(new ManagementObjectNotFoundException(base.GetErrorMessageObjectNotFound(this.Identity.AssociationIdValue, typeof(MailboxAssociationPresentationObject).ToString(), this.Identity.MailboxId.ToString())), ExchangeErrorCategory.Client, this.Identity);
 }
        private MailboxAssociation GetAssociationByItemId(BaseAssociationAdaptor associationAdaptor, MailboxAssociation association)
        {
            MailboxAssociationContext.Tracer.TraceDebug <string>((long)this.GetHashCode(), "MailboxAssociationContext.GetAssociationByItemId [{0}]: Querying association by its item id", this.cmdletName);
            MailboxAssociationFromStore mailboxAssociationFromStore = association as MailboxAssociationFromStore;

            if (mailboxAssociationFromStore != null)
            {
                association = associationAdaptor.GetAssociation(mailboxAssociationFromStore.ItemId);
            }
            return(association);
        }
Esempio n. 4
0
 private void WriteMailboxAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor, ADUser masterMailbox, IExtensibleLogger logger)
 {
     if (association != null)
     {
         ObjectId       objectId            = new MailboxStoreObjectId(masterMailbox.ObjectId, association.ItemId.ObjectId);
         MailboxLocator slaveMailboxLocator = associationAdaptor.GetSlaveMailboxLocator(association);
         if (base.NeedSuppressingPiiData)
         {
             objectId = SuppressingPiiData.RedactMailboxStoreObjectId(objectId);
         }
         base.WriteResult(new MailboxAssociationPresentationObject
         {
             Identity            = objectId,
             ExternalId          = slaveMailboxLocator.ExternalId,
             LegacyDn            = slaveMailboxLocator.LegacyDn,
             IsMember            = association.IsMember,
             JoinedBy            = association.JoinedBy,
             GroupSmtpAddress    = association.GroupSmtpAddress,
             UserSmtpAddress     = association.UserSmtpAddress,
             IsPin               = association.IsPin,
             ShouldEscalate      = association.ShouldEscalate,
             IsAutoSubscribed    = association.IsAutoSubscribed,
             JoinDate            = association.JoinDate,
             LastVisitedDate     = association.LastVisitedDate,
             PinDate             = association.PinDate,
             LastModified        = association.LastModified,
             CurrentVersion      = association.CurrentVersion,
             SyncedVersion       = association.SyncedVersion,
             LastSyncError       = association.LastSyncError,
             SyncAttempts        = association.SyncAttempts,
             SyncedSchemaVersion = association.SyncedSchemaVersion
         });
         return;
     }
     GetMailboxAssociation.Tracer.TraceDebug((long)this.GetHashCode(), "GetMailboxAssocaition.WriteMailboxAssociation. Skipping null MailboxAssociationFromStore.");
 }
        internal bool UpdateAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor)
        {
            bool           result = false;
            MailboxLocator slaveMailboxLocator = associationAdaptor.GetSlaveMailboxLocator(association);

            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.ExternalId))
            {
                slaveMailboxLocator.ExternalId = this.ExternalId;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LegacyDn))
            {
                slaveMailboxLocator.LegacyDn = this.LegacyDn;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsMember))
            {
                association.IsMember = this.IsMember;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.JoinedBy))
            {
                association.JoinedBy = this.JoinedBy;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.GroupSmtpAddress))
            {
                association.GroupSmtpAddress = this.GroupSmtpAddress;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.UserSmtpAddress))
            {
                association.UserSmtpAddress = this.UserSmtpAddress;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsPin))
            {
                association.IsPin = this.IsPin;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.ShouldEscalate))
            {
                association.ShouldEscalate = this.ShouldEscalate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.IsAutoSubscribed))
            {
                association.IsAutoSubscribed = this.IsAutoSubscribed;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.JoinDate))
            {
                association.JoinDate = this.JoinDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LastVisitedDate))
            {
                association.LastVisitedDate = this.LastVisitedDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.PinDate))
            {
                association.PinDate = this.PinDate;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.CurrentVersion))
            {
                association.CurrentVersion = this.CurrentVersion;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncedVersion))
            {
                association.SyncedVersion = this.SyncedVersion;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.LastSyncError))
            {
                association.LastSyncError = this.LastSyncError;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncAttempts))
            {
                association.SyncAttempts = this.SyncAttempts;
                result = true;
            }
            if (base.IsChanged(MailboxAssociationPresentationObject.MailboxAssociationPresentationObjectSchema.SyncedSchemaVersion))
            {
                association.SyncedSchemaVersion = this.SyncedSchemaVersion;
                result = true;
            }
            return(result);
        }