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 
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Patrick,
I will test it in Outlook XP and let you know about results.
I use Outlook 2003.
Posted 09 Dec, 2004 09:54:03 Top
Patrick Behr




Posts: 12
Joined: 2004-12-09
Thank you, that's excellent.

I Test it! If I print out the subject of the selected item, I get the right one, but the flag is olNoFlag. Thats really strainge!
Posted 09 Dec, 2004 10:09:48 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Patrick,
I have a feeling we misunderstand each other. Do you mark a message via
"Follow Up..." item from Outlook popup menu by right clicking on mail item? In this case the FlagStatus property should return a value different from olNoFlag. I have tested my code with Outlook XP, everything works properly.
Posted 09 Dec, 2004 11:10:38 Top
Patrick Behr




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

I find a solution 10 minutes ago! :) The activeExplorer.Selection.count give me the number of the marked mails in my Inbox. With this selection and a for-loop I can "run" though all marked mails and find out the subject, et cetera.
But I think you halp me very much! Thank you for your advice!

Regrads!

Patrick
Posted 10 Dec, 2004 02:29:42 Top
Patrick Behr




Posts: 12
Joined: 2004-12-09
Hello everybody,

is there the possibilty to extract the content of an attachment (f.e. the text of a word document) with C# and the selection.Item(i).Attachments. ...?
Or can a bundle the whole in an object?

Thank you!
Posted 10 Dec, 2004 08:50:50 Top
Sergey Grischenko


Add-in Express team


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

You can use the last code I have sent you with minimum changes and test the following:
mail = selectedItem as Outlook.MailItem;
attachments = mail.Attachments;
for(int i=1; i<=attachments.Count; i++)
{
attachment = attachments.Item(i);
attachment.SaveAsFile(Path.Combine("d:\\", attachment.FileName));
Marshal.ReleaseComObject(attachment);
}
Marshal.ReleaseComObject(attachments);
All attachments will be saved on disk and can be available for reading by proper applications, e.g Word.
Posted 10 Dec, 2004 10:45:10 Top
Patrick Behr




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

@ Sergey: I think, I've describe my problem to diffuse.

I like to transform the attachment file to an binary code. Later I want to write the From, Subject, Date, Body Attributes and the binary code into a XML String and send this String to a webservice. I saw an example in JAVA and now I try to build this in C#. And I hope I will run.
Is there a really good .net - webpage, where I can find an discription how I can transform the attached Object in binary code and which Ressources I have to add?

Regrads!
Posted 13 Dec, 2004 02:17:33 Top
Sergey Grischenko


Add-in Express team


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

You can visit http://www.outlookcode.com/. It is a very good resource related to Outlook.
As for transformation an attached object into binary code, I see two way to realise your idea. The first way is using Extended MAPI interfaces and the second way is storing an attached object on the disk and then opening it with the FileStream class to get a stream of bytes.
Posted 13 Dec, 2004 05:59:42 Top
Patrick Behr




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

I know outlookcode.com, but I couldn't find a solution. I won't store the attachment on my filesystem. But what I have to understand with Extended MAPI interfaces? If I use google, there is no good solution.

I know a with a Base64Encoder, but run in Java. Is there an possibiltity in C#?

Posted 13 Dec, 2004 06:40:53 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
You can find information on Extended MAPI interfaces in Microsoft SDK.
As for your example in Java, I need to see it to be able to tell you whether it is possible in C#.
Posted 13 Dec, 2004 08:40:25 Top