John R. Durant's WebLog

Blog of "The" Office Developer

Outlook, .NET, and WordML- the first of a short series.

If you are like me, you do not enjoy writing status reports to your manager. Fortunately, I have a manager that is not a micro-manager. Anyway, I wrote a little sample that pulls data from Outlook and dumps it into an XML file. I then run XSL’s  against the file to create nicely formatted Word documents. Over my next few blog entries, I am going to share a few lessons learned about this little project. I am pulling it all together (with complete code) into an article that I will pub in my OfficeTalk column for March. Look for my other articles here: http://msdn.microsoft.com/library/en-us/odc_2003_ta/html/odc_landOfficeTalk_ta.asp

Anyway, so here’s how my little sample shakes out (thanks to Chris Kunicki at www.OfficeZealot.com for giving me some space for image files for this blog):

 

I use a simple C# application to walk the Outlook Object Model and extract all of my Task items, dumping their contents into a well-formed XML file. Here's a sample of what it produces (I changed the text from my real tasks, as they are much more boring!):

<?xml version="1.0"?>
<?mso-solutionextension URI="OutlookTaskExporter" manifestPath="OutlookTaskExporterSolution.xml"?>
<Tasks xmlns="OutlookTaskExporter">
  <SummaryInfo>Status Report for: John R. Durant--2/25/2004</SummaryInfo>
  <Task Subject="Write blog entry" Due="2/28/2004" PercentComplete="30">
    <category>ODC</category>
    <Notes>Check out content on my site: http://msdn.microsoft.com/office
</Notes>
  </Task>
  <Task Subject="Hook up with Taiwan sales force" Due="2/27/2004" PercentComplete="75">
    <category>ODC</category>
    <Notes>Establish plan for Office development evangelism tour.</Notes>
  </Task></Tasks>

In my next entry, I will explain what these processing instructions mean, and I will share some of the C# code (it's not rocket science) that creates the XML file.

OK- so my rock thought for the day is this: I now realize that I must get serious about buying all of the Foo Fighter's albums. It's just great, loud, amped up rock and roll.

Has anyone checked out Grohl's new album Probot?

Rock on!

Published Friday, February 27, 2004 6:58 AM by johnrdurant

Comments

 

bilbo said:

Grohl is my fave! Incredibly talented. I've noticed that there are songs of his that I dislike at first but after a few listens they grow more and more on me! Before I know it, songs I dislike become favorites.

Definitely needs to be played LOUD!
February 27, 2004 7:50 AM
 

David Cumps said:

Very excited to see more of this :)
February 27, 2004 8:21 AM
 

John R. Durant's WebLog said:

February 27, 2004 3:55 PM
 

Enjoy Every Sandwich said:

Take Outs: The Digital Doggy Bag of Blog Bits for 27 February 2004
February 27, 2004 6:17 PM
 

John R. Durant's WebLog said:

May 28, 2004 3:50 PM
 

dawn said:

I have been trying for a month without success. I am new to both C# and .NET, and it is my first job...so you can imagine the picture. Please help!
I start from a win app and have tried creating a library class, component class or just running it all from my form.

What I have been able to do so far:
Open Outlook, go to the default folders then to the Inbox folder, count the no of items, open and save all the info I want to an XML export file or display it in a datagrid on my form. I have also been able to select just some of the email messages with a specific subject title and display that in the consolewriteline window.

My problem:
I need to read the incoming emails, look for a specific subject (I created an outlook form for a specific report we want to track--that gets emailed to various people, including me) read specific strings from that info (I have some titles and then tabs delineating different info) and save certain string info to my dataset and a db table for retrieval by another component my collegue is working on. His system listens for changes in production and then calls up my table to compare the information.

The problem is the generator of these emails sometimes uses excel attachments to the email that take the place of some of the string message info I would read from the email. The way I see it, I need to:
Open Outlook.
Check Inbox for emails.
Check emails for subject "Kampani"
Read email info to a dataset
-If attachments are present or if the info is blank in the msg body
-Read the info from the attached file
-If the model no is a string with a hyphen in it,
--Enumerate ranges in the model no separated by a hyphen
-Concatenate two types of fields (model typ and model no) from either the msg body or the attached file

After all emails have been processed close Outlook
Write dataset (info) to the SQL db table I have already.
July 8, 2004 2:00 AM
 

dianyingxiazai said:

[href=http://www.dmoz.net.cn/ wangzhidaquang]
[href=http://www.86dmoz.com/ jingpingwangzhi]
[href=http://movie.kamun.com/ mianfeidianying]
[href=http://www.kamun.com/ dianyingxiazai]
[href=http://music.kamun.com/ MP3 free download]
[href=http://www.pc530.net/ diannaoaihaozhe]
[href=http://www.5icc.com/ duangxingcaixingxiazha]
[href=http://www.dianyingxiazai.com/ dianyingxiazai]
[href=http://www.yinyuexiazai.com/ yinyuexiazai]
August 1, 2004 11:49 PM
 

John R Durant s WebLog Outlook NET and WordML the first of a | Hair Growth Products said:

June 9, 2009 4:38 AM
 

John R Durant s WebLog Outlook NET and WordML the first of a | bar stools said:

June 19, 2009 2:32 AM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker