private MessageEntry(PSTMessage message) : base(message) { this.message = message; this.uploadContext = null; this.messageProcessor = null; this.message.PropertyBag.SetProperty(new PropertyValue(PSTFxProxyPool.MessageEntry.MsgStatusPropertyTag, 0)); }
private void EnumerateMessagesHelper(List <uint> messageIds, PropTag[] additionalPtagsToLoad, List <MessageRec> messageList) { foreach (uint num in messageIds) { IMessage message = null; PropValueData[] additionalProps = null; PropertyValue property = PstFolder.errorPropertyValue; PropertyValue property2 = PstFolder.errorPropertyValue; try { message = this.folder.PstMailbox.IPst.ReadMessage(num); } catch (PSTIOException innerException) { throw new UnableToGetPSTFolderPropsTransientException(BitConverter.ToUInt32(this.folderId, 0), innerException); } catch (PSTExceptionBase pstexceptionBase) { MrsTracer.Provider.Error("PstFolder.EnumerateMessages failed while reading message: {0}", new object[] { pstexceptionBase }); } if (message != null) { using (PSTMessage pstmessage = new PSTMessage(this.folder.PstMailbox, message)) { if (additionalPtagsToLoad != null) { additionalProps = new PropValueData[additionalPtagsToLoad.Length]; PropertyValue[] array = new PropertyValue[additionalPtagsToLoad.Length]; for (int i = 0; i < additionalPtagsToLoad.Length; i++) { array[i] = pstmessage.RawPropertyBag.GetProperty(PstMailbox.MoMTPtagFromPtag(additionalPtagsToLoad[i])); } additionalProps = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(PstMailbox.PvaFromMoMTPva(array)); } property = pstmessage.RawPropertyBag.GetProperty(PropertyTag.CreationTime); property2 = pstmessage.RawPropertyBag.GetProperty(PropertyTag.MessageSize); } } byte[] entryId = PstMailbox.CreateEntryIdFromNodeId(this.folder.PstMailbox.IPst.MessageStore.Guid, num); MessageRec item = new MessageRec(entryId, this.FolderId, property.IsError ? DateTime.MinValue : ((DateTime)((ExDateTime)property.Value)), property2.IsError ? 1000 : ((int)property2.Value), this.folder.PstMailbox.IPst.CheckIfAssociatedMessageId(num) ? MsgRecFlags.Associated : MsgRecFlags.None, additionalProps); messageList.Add(item); } }
public PSTAttachment(PSTMessage parentMessage, IAttachment iPstAttachment) { this.parentMessage = parentMessage; this.iPstAttachment = iPstAttachment; this.propertyBag = new PSTPropertyBag(parentMessage.PstMailbox, iPstAttachment.PropertyBag); PropertyValue property = this.propertyBag.GetProperty(PropertyTag.AttachmentNumber); if (property.IsError) { property = new PropertyValue(PropertyTag.AttachmentNumber, (int)iPstAttachment.AttachmentNumber); } this.propertyBag.SetProperty(property); this.attachmentNumber = (int)property.Value; if (iPstAttachment.Message != null) { this.embeddedMessage = new PSTMessage(parentMessage.PstMailbox, iPstAttachment.Message, true); } }
protected override void CopySingleMessage(MessageRec message, IFolderProxy targetFolderProxy, PropTag[] propsToCopyExplicitly, PropTag[] propTagsToExclude) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("PstSourceMailbox.CopySingleMessage", OperationType.None), new EntryIDsDataContext(message.EntryId) }).Execute(delegate { try { uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId); IMessage message2 = this.IPst.ReadMessage(nodeIdFromEntryId); if (message2 == null) { throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, nodeIdFromEntryId); } PSTMessage pstmessage = new PSTMessage(this, message2); using (IMessageProxy messageProxy = targetFolderProxy.OpenMessage(message.EntryId)) { FxCollectorSerializer fxCollectorSerializer = new FxCollectorSerializer(messageProxy); fxCollectorSerializer.Config(0, 1); using (FastTransferDownloadContext fastTransferDownloadContext = FastTransferDownloadContext.CreateForDownload(FastTransferSendOption.Unicode | FastTransferSendOption.UseCpId | FastTransferSendOption.ForceUnicode, 1U, pstmessage.RawPropertyBag.CachedEncoding, NullResourceTracker.Instance, this.GetPropertyFilterFactory(PstMailbox.MoMTPtaFromPta(propTagsToExclude)), false)) { FastTransferMessageCopyTo fastTransferObject = new FastTransferMessageCopyTo(false, pstmessage, true); fastTransferDownloadContext.PushInitial(fastTransferObject); FxUtils.TransferFxBuffers(fastTransferDownloadContext, fxCollectorSerializer); messageProxy.SaveChanges(); } } } catch (PSTExceptionBase innerException) { throw new UnableToReadPSTMessagePermanentException(this.IPst.FileName, PstMailbox.GetNodeIdFromEntryId(this.IPst.MessageStore.Guid, message.EntryId), innerException); } }); }