Пример #1
0
 // Token: 0x060006FA RID: 1786 RVA: 0x0001A1CC File Offset: 0x000183CC
 public static OrganizationId ResolveCurrentUserOrganization(out ADObjectId userId)
 {
     userId = null;
     try
     {
         using (WindowsIdentity current = WindowsIdentity.GetCurrent())
         {
             if (current == null)
             {
                 return(null);
             }
             IRootOrganizationRecipientSession rootOrganizationRecipientSession = DirectorySessionFactory.Default.CreateRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 1263, "ResolveCurrentUserOrganization", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\TaskHelper.cs");
             ADRawEntry adrawEntry = rootOrganizationRecipientSession.FindADRawEntryBySid(current.User, new ADPropertyDefinition[]
             {
                 ADObjectSchema.RawName,
                 ADObjectSchema.Name,
                 ADObjectSchema.Id,
                 ADObjectSchema.ExchangeVersion,
                 ADObjectSchema.OrganizationalUnitRoot,
                 ADObjectSchema.ConfigurationUnit
             });
             if (adrawEntry == null)
             {
                 return(null);
             }
             userId = adrawEntry.Id;
             return((OrganizationId)adrawEntry[ADObjectSchema.OrganizationId]);
         }
     }
     catch (InvalidOperationException e)
     {
         TaskLogger.LogError(e);
     }
     catch (DataSourceOperationException e2)
     {
         TaskLogger.LogError(e2);
     }
     catch (TransientException e3)
     {
         TaskLogger.LogError(e3);
     }
     catch (DataValidationException e4)
     {
         TaskLogger.LogError(e4);
     }
     return(null);
 }
Пример #2
0
        // Token: 0x0600166B RID: 5739 RVA: 0x00054D24 File Offset: 0x00052F24
        private void ReportException(object sender, GenericEventArg <TaskErrorEventArg> e)
        {
            if (e.Data.ExceptionHandled)
            {
                return;
            }
            TaskLogger.LogError(e.Data.Exception);
            bool flag;

            if (this.context != null && this.context.ErrorInfo.Exception != null && !this.context.ErrorInfo.IsKnownError && TaskHelper.ShouldReportException(e.Data.Exception, out flag))
            {
                if (!flag)
                {
                    this.context.CommandShell.WriteWarning(Strings.UnhandledErrorMessage(e.Data.Exception.Message));
                }
                TaskLogger.SendWatsonReport(e.Data.Exception, this.context.InvocationInfo.CommandName, this.context.InvocationInfo.UserSpecifiedParameters);
            }
        }