Beispiel #1
0
        internal static IMessage CreatePstMessage(IPST pstSession, IFolder pstFolder, ItemInformation item, bool removeMetadata)
        {
            IMessage       message        = pstFolder.AddMessage();
            ExtractContext extractContext = new ExtractContext(pstSession, item);

            extractContext.EnterMessageContext(message);
            FastTransferStreamExtractor fastTransferStreamExtractor = new FastTransferStreamExtractor(extractContext, removeMetadata);

            fastTransferStreamExtractor.Extract();
            extractContext.ExitMessageContext();
            return(message);
        }
Beispiel #2
0
        void IMailbox.Connect(MailboxConnectFlags connectFlags)
        {
            MrsTracer.Provider.Function("PstMailbox.IMailbox.Connect", new object[0]);
            this.ValidateCodePageAndSetEncoding();
            IPST ipst = null;

            try
            {
                ipst = new PSTSession(new Tracer.TraceMethod(MrsTracer.Provider.Debug), new Tracer.TraceMethod(MrsTracer.Provider.Warning), new Tracer.TraceMethod(MrsTracer.Provider.Error));
                ipst.Open(this.filePath, this is PstDestinationMailbox, this is PstDestinationMailbox, (connectFlags & MailboxConnectFlags.ValidateOnly) != MailboxConnectFlags.None);
            }
            catch (PSTExceptionBase pstexceptionBase)
            {
                throw new UnableToOpenPSTPermanentException(this.filePath, pstexceptionBase.Message, pstexceptionBase);
            }
            catch (UnauthorizedAccessException ex)
            {
                if (Directory.Exists(this.filePath))
                {
                    throw new PSTPathMustBeAFilePermanentException(ex);
                }
                throw new UnableToOpenPSTPermanentException(this.filePath, ex.Message, ex);
            }
            catch (IOException ex2)
            {
                if (ex2 is PathTooLongException || ex2 is DirectoryNotFoundException || ex2 is FileNotFoundException)
                {
                    throw new UnableToOpenPSTPermanentException(this.filePath, ex2.Message, ex2);
                }
                throw new PSTIOExceptionTransientException(ex2);
            }
            catch (SecurityException ex3)
            {
                throw new UnableToOpenPSTPermanentException(this.filePath, ex3.Message, ex3);
            }
            this.iPst = ipst;
            MrsTracer.Provider.Debug("Successfully opened PST file '{0}'", new object[]
            {
                this.filePath
            });
        }
 public ExtractContext(IPST pstSession, ItemInformation item)
 {
     this.containerStack = new Stack <ExtractContext.PropertyBagContainer>();
     this.Item           = item;
     this.PstSession     = pstSession;
 }