EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElMessagePart.GetText returns empty value when accessed a second time

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#22650
Posted: 11/29/2012 07:55:22
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

Consider the following program:
Code
static void Main(string[] args)
      {
         TElMessage message = new TElMessage(string.Format("iCPS - {0}", SBMIME.Unit.cXMailerDefaultFieldValue));

         message.SetMainPart(new TElPlainTextPart(), false);
         message.MainPart.SetText("This is the body part value.");

         string mainPartTextValue = null;

         message.MainPart.GetText(ref mainPartTextValue);
         Console.WriteLine("Text value on first access: [{0}].", mainPartTextValue);

         message.MainPart.GetText(ref mainPartTextValue);
         Console.WriteLine("Text value on first access: [{0}].", mainPartTextValue);

      }


We set the main part to a plain text part and set the text. The we try to print the text of the message twice. The output of the program above becomes:

Quote

Text value on first access: [This is the body part value.].
Text value on first access: [].


Why does the value disappear after retrieving it the first time!?
#22651
Posted: 11/29/2012 08:05:19
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Please, try to add SBMIME.Unit.mpoLoadData to TElPlainTextPart.Options as described here: http://www.eldos.com/documentation/sb...tions.html
#22656
Posted: 11/29/2012 09:45:28
by Peter Palotas (Basic support level)
Joined: 11/01/2012
Posts: 49

Tahnks. This seems to have done the trick. But it seems like kind of a strange behavior to have the text disappear like that when this option is not specified, does it not?

Regards, Peter.
#22657
Posted: 11/29/2012 12:30:20
by Vsevolod Ievgiienko (EldoS Corp.)

Its not strange because this behavior is by design. As MIME messages may be very large there a few options that optimize memory usage. This behavior is controlled by the above mentioned option.

Reply

Statistics

Topic viewed 489 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!