Exemple #1
0
        private long WriteAttachedItem(ItemAttachment attachment)
        {
            Item item   = ConvertUtils.OpenAttachedItem(attachment);
            long result = 0L;

            if (item != null)
            {
                try
                {
                    this.limitsTracker.StartEmbeddedMessage();
                    Charset itemWindowsCharset = ConvertUtils.GetItemWindowsCharset(item, this.options);
                    using (ItemToTnefConverter.TnefContentWriter embeddedMessageWriter = this.tnefWriter.GetEmbeddedMessageWriter(itemWindowsCharset))
                    {
                        OutboundAddressCache outboundAddressCache = new OutboundAddressCache(this.options, this.limitsTracker);
                        outboundAddressCache.CopyDataFromItem(item);
                        if (this.tnefType == TnefType.LegacyTnef && this.options.ResolveRecipientsInAttachedMessages)
                        {
                            outboundAddressCache.Resolve();
                        }
                        using (ItemToTnefConverter itemToTnefConverter = new ItemToTnefConverter(item, outboundAddressCache, embeddedMessageWriter, this.options, this.limitsTracker, this.tnefType, true))
                        {
                            ConversionResult conversionResult = itemToTnefConverter.Convert();
                            result = conversionResult.BodySize + conversionResult.AccumulatedAttachmentSize;
                        }
                    }
                    this.limitsTracker.EndEmbeddedMessage();
                }
                finally
                {
                    item.Dispose();
                }
            }
            return(result);
        }
Exemple #2
0
        private void WriteTnefParticipant(TnefAttributeTag legacyTnefAttribute, ConversionItemParticipants.ParticipantIndex index)
        {
            Participant participant = this.addressCache.Participants[index];

            if (ItemToTnefConverter.IsCompleteParticipant(participant))
            {
                this.tnefWriter.StartAttribute(legacyTnefAttribute, TnefAttributeLevel.Message);
                EmbeddedParticipantProperty embeddedParticipantProperty = ConversionItemParticipants.GetEmbeddedParticipantProperty(index);
                this.tnefWriter.WriteProperty(embeddedParticipantProperty.EmailAddressPropertyDefinition, participant.EmailAddress);
                this.tnefWriter.WriteProperty(embeddedParticipantProperty.RoutingTypePropertyDefinition, participant.RoutingType);
                this.tnefWriter.WriteProperty(embeddedParticipantProperty.DisplayNamePropertyDefinition, string.IsNullOrEmpty(participant.DisplayName) ? participant.EmailAddress : participant.DisplayName);
            }
        }