Get mails from the Inbox?

Add-in Express™ Support Service
That's what is more important than anything else

Get mails from the Inbox?
Export mails from the Outlook Inbox 
Patrick Behr




Posts: 12
Joined: 2004-12-09
I also found a base64encoder for c#, but I don't know how I have to handle it. Base64Encoder
This encoder requireds an ByteString, but I don't know how I can "convert" my Attachment Object to an ByteString! I know it sounds stainge! ;)

I test it with the following:


public class Encoder
{
  public static ByteString encode(ByteString toEncode)
  {
    ByteString bytestr = new ByteString("");
    Base64Encoder bs = new Base64Encoder();
    bytestr = (ByteString)bs.Encode(toEncode);
		
    return bytestr;
  }
}


and I try to convert the Attachment Object to a ByteString and call this method.
Posted 13 Dec, 2004 09:20:43 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Patrick,

I will try to find a proper solution for you and let you know tomorrow.
Posted 13 Dec, 2004 11:31:21 Top
Patrick Behr




Posts: 12
Joined: 2004-12-09
Hi Sergey,

I try to find a solution. I save the attachment as File then I open a filereader and to read the bytes. The problem is, that the filereader returns some byteArrays. My problem is: I don't know how I can put togehther two or more byteArrays to one. If i read all bytes of the stream, I can convert these to a ByteString and than i can encode it with the Base64Encoder.

Posted 14 Dec, 2004 07:25:41 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Patrick,

Try the following code to get one common array:

byte[] array1 = new byte[10];
byte[] array2 = new byte[10];
byte[] array3 = new byte[array1.Length+array2.Length];
array1.CopyTo(array3, 0);
array2.CopyTo(array3, array1.Length);
Posted 14 Dec, 2004 07:39:59 Top
Patrick Behr




Posts: 12
Joined: 2004-12-09
Hi Sergey,

I don't no want is wrong. The byteArray are filled, but the length ist allways null.

This is my function, to get the bytes of the attachment file:


for (int j=1;j<=mail.Attachments.Count;j++)
{
  string path = @"c:Temp";
  string filename = mail.Attachments.Item(j).DisplayName;
  mail.Attachments.Item(j).SaveAsFile(path+filename);
  FileStream fs = new FileStream(path+filename, FileMode.Open, FileAccess.Read);
  BinaryReader r = new BinaryReader(fs);
  byte[] output = new byte[32000];
  int byteArrayCounter = 0;							
  for (int k = 0; k < fs.Length; k++)
  {
    if (byteArrayCounter == 0)
    {
      output = r.ReadBytes(k);
      byteArrayCounter++;
    }
    else
    {
      byte[] tmpcur = new byte[r.ReadBytes(k).Length];
      byte[] tmpbefore = new byte[output.Length];
      tmpcur = r.ReadBytes(k);
      tmpbefore = output;
      tmpbefore.CopyTo(output,tmpbefore.Length);
      tmpcur.CopyTo(output,output.Length+tmpcur.Length);
      MessageBox.Show(output.ToString());
    }
  }
fs.Close();
File.Delete(path+filename);
Posted 14 Dec, 2004 08:13:18 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hello Patrik,

It seems it's high time to notice that your questions relate directly to
our premium support service.

Hello Sergey,

I would like you to stop this discussion.

Thank you for your understanding.
Posted 14 Dec, 2004 08:41:44 Top
Patrick Behr




Posts: 12
Joined: 2004-12-09
Is it a problem, if we discuss some interresting things? I think that are problem and solutions, that other users also are looking for.
Posted 14 Dec, 2004 09:33:11 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Yes, it is. There are two ways - we develop the next version or we discuss interesting things and our revenue comes down to zero :-)
Posted 14 Dec, 2004 11:01:43 Top