private bool IsExternalFreeBusyFolderCreated(string legacyDN, PublicFolderDatabase publicFolderDatabase)
        {
            Server server = publicFolderDatabase.GetServer();

            if (server == null)
            {
                return(false);
            }
            bool result;

            try
            {
                using (PublicFolderSession publicFolderSession = this.GetPublicFolderSession(server))
                {
                    StoreObjectId freeBusyFolderId = FreeBusyFolder.GetFreeBusyFolderId(publicFolderSession, legacyDN, FreeBusyFolderDisposition.None);
                    result = (freeBusyFolderId != null);
                }
            }
            catch (LocalizedException)
            {
                base.WriteVerbose(Strings.InstallFreeBusyFolderUnableToCheckDatabase(publicFolderDatabase.Id.ToString()));
                result = false;
            }
            return(result);
        }
Exemple #2
0
        internal static void DoMaintenanceTask(PublicFolderDatabase publicStore, string domainController, Task.TaskWarningLoggingDelegate warningHandler)
        {
            Server server = publicStore.GetServer();

            if (!server.IsExchange2007OrLater)
            {
                warningHandler(Strings.WarningSiteFolderCheckTaskNotAvailableOnTiServer(server.Name));
                return;
            }
            string a = domainController;

            try
            {
                a = SystemConfigurationTasksHelper.GetConfigurationDomainControllerFqdn(domainController);
            }
            catch (SocketException ex)
            {
                warningHandler(Strings.ErrorResolveFqdnForDomainController(domainController, ex.Message));
            }
            string configDC = ADSession.GetConfigDC(TopologyProvider.LocalForestFqdn, server.Name);

            if (string.Equals(a, configDC, StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", server.Fqdn, null, null, null))
                    {
                        exRpcAdmin.DoMaintenanceTask(publicStore.Guid, MaintenanceTask.SiteFolderCheck);
                    }
                    return;
                }
                catch (MapiPermanentException ex2)
                {
                    TaskLogger.Trace("Set/New-OfflineAddressBook.InternalProcessRecord raises exception while running site folder check task: {0}", new object[]
                    {
                        ex2.Message
                    });
                    warningHandler(Strings.ErrorFailedToRunSiteFolderCheckTask(server.Name, ex2.Message));
                    return;
                }
                catch (MapiRetryableException ex3)
                {
                    TaskLogger.Trace("Set/New-OfflineAddressBook.InternalProcessRecord raises exception while running site folder check task: {0}", new object[]
                    {
                        ex3.Message
                    });
                    warningHandler(Strings.ErrorFailedToRunSiteFolderCheckTask(server.Name, ex3.Message));
                    return;
                }
            }
            warningHandler(Strings.WarningOabSiteFolderCheckNotRun(server.Name));
        }