internal static bool InitializeExchangePropertyContainerIfNeeded(ISessionState sessionState, out ADObjectId executingUserId, out OrganizationId executingUserOrganizationId) { executingUserId = null; executingUserOrganizationId = null; if (sessionState != null && !ExchangePropertyContainer.IsContainerInitialized(sessionState)) { ExTraceGlobals.LogTracer.Information(0L, "ExchangePropertyContainer is not initialized. Case of Service, Setup or Powershell with manually added snapin"); executingUserOrganizationId = TaskHelper.ResolveCurrentUserOrganization(out executingUserId); if (executingUserOrganizationId == null) { executingUserOrganizationId = OrganizationId.ForestWideOrgId; } ExchangePropertyContainer.InitExchangePropertyContainer(sessionState, executingUserOrganizationId, executingUserId); return(true); } return(false); }