예제 #1
0
        private bool TryStoreSyncErrors(EhfADAdapter adapter)
        {
            object[] array = null;
            string   text  = null;

            if (this.ContainsCurrentSyncErrors)
            {
                array = new object[this.syncErrors.Count];
                for (int i = 0; i < this.syncErrors.Count; i++)
                {
                    array[i] = this.syncErrors[i];
                }
                text = "save";
            }
            else if (this.ContainsPreviousSyncErrors)
            {
                text = "remove";
            }
            if (text == null)
            {
                return(true);
            }
            Guid objectGuid = this.GetObjectGuid();

            try
            {
                adapter.SetAttributeValues(objectGuid, "msExchEdgeSyncCookies", array);
            }
            catch (ExDirectoryException ex)
            {
                if (ex.ResultCode == ResultCode.NoSuchObject)
                {
                    this.DiagSession.LogAndTraceException(ex, "NoSuchObject error occurred while trying to {0} sync errors for AD object <{1}>:<{2}>; ignoring the error", new object[]
                    {
                        text,
                        this.DistinguishedName,
                        objectGuid
                    });
                    return(true);
                }
                this.DiagSession.LogAndTraceException(ex, "Exception occurred while trying to {0} sync errors for AD object <{1}>:<{2}>", new object[]
                {
                    text,
                    this.DistinguishedName,
                    objectGuid
                });
                this.DiagSession.EventLog.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfFailedUpdateSyncErrors, this.DistinguishedName, new object[]
                {
                    this.DistinguishedName,
                    text,
                    ex
                });
                return(false);
            }
            this.DiagSession.Tracer.TraceDebug <string, string, Guid>((long)this.DiagSession.GetHashCode(), "Successfully {0}d sync errors for AD object <{1}>:<{2}>", text, this.DistinguishedName, objectGuid);
            return(true);
        }
예제 #2
0
        private void UpdateSyncStateInAD(EhfCompanyAdmins admins, EhfADAdapter configADAdapter, bool syncAdminAccountsCompleted, bool syncAdminAgentCompleted, bool syncHelpdeskAgentCompleted)
        {
            EhfAdminSyncState ehfAdminSyncState = EhfAdminSyncState.Create(admins, syncAdminAccountsCompleted, syncAdminAccountsCompleted, syncAdminAgentCompleted, syncHelpdeskAgentCompleted, base.EhfConnection);

            if (ehfAdminSyncState.IsEmpty)
            {
                base.DiagSession.LogAndTraceInfo(EdgeSyncLoggingLevel.Low, "Admin state is up to date for <{0}>. No need to update the state.", new object[]
                {
                    admins.TenantOU
                });
                return;
            }
            try
            {
                configADAdapter.SetAttributeValues(admins.EhfCompanyIdentity.EhfCompanyGuid, ehfAdminSyncState.GetStatesToUpdate());
            }
            catch (ExDirectoryException exception)
            {
                this.HandleFaultAsTransientFailure(admins.EhfCompanyIdentity, "Update Sync State", exception, true, string.Empty);
            }
        }