Exemple #1
0
 private void GetHierarchy(IFolder iFolder, List <FolderRec> hierarchy, PropertyTag[] momtPtagsToLoad)
 {
     using (PstFxFolder pstFxFolder = new PstFxFolder(this, iFolder))
     {
         hierarchy.Add(FolderRec.Create(PstMailbox.PvaFromMoMTPva(pstFxFolder.GetProps(momtPtagsToLoad))));
         foreach (uint num in iFolder.SubFolderIds)
         {
             IFolder folder;
             try
             {
                 folder = this.iPst.ReadFolder(num);
             }
             catch (PSTIOException innerException)
             {
                 throw new UnableToReadPSTFolderTransientException(num, innerException);
             }
             catch (PSTExceptionBase innerException2)
             {
                 throw new UnableToReadPSTFolderPermanentException(num, innerException2);
             }
             if (folder == null)
             {
                 MrsTracer.Provider.Error("Pst folder 0x{0:x} does not exist", new object[]
                 {
                     num
                 });
             }
             else
             {
                 this.GetHierarchy(folder, hierarchy, momtPtagsToLoad);
             }
         }
     }
 }
Exemple #2
0
        List <FolderRec> IMailbox.EnumerateFolderHierarchy(EnumerateFolderHierarchyFlags flags, PropTag[] additionalPtagsToLoad)
        {
            MrsTracer.Provider.Function("PstMailbox.IMailbox.EnumerateFolderHierarchy({0})", new object[]
            {
                flags
            });
            List <FolderRec> list  = new List <FolderRec>(50);
            List <PropTag>   list2 = new List <PropTag>(FolderRec.PtagsToLoad);

            if (additionalPtagsToLoad != null)
            {
                list2.AddRange(additionalPtagsToLoad);
            }
            PropertyTag[] array = PstMailbox.MoMTPtaFromPta(list2.ToArray());
            try
            {
                IFolder folder = this.iPst.ReadFolder(290U);
                if (folder == null)
                {
                    throw new UnableToGetPSTHierarchyPermanentException(this.filePath);
                }
                using (PstFxFolder pstFxFolder = new PstFxFolder(this, folder))
                {
                    list.Add(FolderRec.Create(PstMailbox.PvaFromMoMTPva(pstFxFolder.GetProps(array))));
                    PropertyValue property = this.MessageStorePropertyBag.GetProperty(PropertyTag.IPMSubtreeFolder);
                    if (property.IsError || ((byte[])property.Value).Length != 24)
                    {
                        throw new UnableToGetPSTHierarchyPermanentException(this.filePath);
                    }
                    uint    nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.iPst.MessageStore.Guid, (byte[])property.Value, true);
                    IFolder folder2           = this.iPst.ReadFolder(nodeIdFromEntryId);
                    if (folder2 == null)
                    {
                        throw new UnableToGetPSTHierarchyPermanentException(this.filePath);
                    }
                    this.GetHierarchy(folder2, list, array);
                }
            }
            catch (PSTIOException innerException)
            {
                throw new UnableToGetPSTHierarchyTransientException(this.filePath, innerException);
            }
            catch (PSTExceptionBase innerException2)
            {
                throw new UnableToGetPSTHierarchyPermanentException(this.filePath, innerException2);
            }
            MrsTracer.Provider.Debug("PST hierarchy contains {0} folders including root", new object[]
            {
                list.Count
            });
            return(list);
        }