Example #1
0
        private static StoreObjectId GetFreeBusyFolderIdInternal(PublicFolderSession session, string legacyDN, FreeBusyFolderDisposition disposition)
        {
            string freeBusyFolderName = FreeBusyFolder.GetFreeBusyFolderName(legacyDN);

            if (freeBusyFolderName == null)
            {
                FreeBusyFolder.Tracer.TraceError <string>(0L, "Unable to get free/busy folder for mailbox with legacy DN '{0}' because cannot obtain folder name from legacy DN", legacyDN);
                return(null);
            }
            StoreObjectId freeBusyRootFolderId = FreeBusyFolder.GetFreeBusyRootFolderId(session);

            if (freeBusyRootFolderId == null)
            {
                return(null);
            }
            StoreObjectId result;

            try
            {
                StoreObjectId storeObjectId = null;
                using (Folder folder = Folder.Bind(session, freeBusyRootFolderId))
                {
                    storeObjectId = QueryChildFolderByName.Query(folder, freeBusyFolderName);
                }
                if (storeObjectId == null && disposition == FreeBusyFolderDisposition.CreateIfNeeded)
                {
                    storeObjectId = FreeBusyFolder.CreateFreeBusyFolder(session, freeBusyRootFolderId, freeBusyFolderName);
                }
                result = storeObjectId;
            }
            catch (StoragePermanentException arg)
            {
                FreeBusyFolder.Tracer.TraceDebug <StoragePermanentException>(0L, "Failed to get free/busy folder due exception: {0}", arg);
                result = null;
            }
            return(result);
        }
Example #2
0
 public static StoreObjectId GetFreeBusyFolderId(PublicFolderSession session, string legacyDN, FreeBusyFolderDisposition disposition)
 {
     return(FreeBusyFolder.RetryOnStorageTransientException <StoreObjectId>(() => FreeBusyFolder.GetFreeBusyFolderIdInternal(session, legacyDN, disposition)));
 }