Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Working with Outlook 2003 and C#

Posted on 2004-08-16
3
Medium Priority
?
594 Views
Last Modified: 2008-01-09
I'm currently working on a program which checks my Outlook Profile for Mail Delivery Reports. As they are other objects than MailItems (that are ReportItems), I have a problem to list all the items in the inbox. Is there a way to filter the inbox via C# to list only the ReportItems.

For example i've this:
foreach(Outlook.ReportItem oReport in oItems)
{
   Console.WriteLine(oReport.Subject);
}

but as soon as a MailItem occurs I'll get an error.

Well filtering is the first problem ... the other problem I have is, I've created a special Profile (Control Panel -> Mail) where I loaded another PST file with Delivery Report Mails in it. The problem I have is, how can I connect to the PST file via the Profile? Or how do I connect to another folder than the InboxFolder(Outlook.MAPIFolder oInbox = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);)
0
Comment
Question by:SiraX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Assisted Solution

by:gillgates
gillgates earned 1000 total points
ID: 11812178
I am not familiar with Outlook.ReportItem but did you see if there was something like Outlook.ReportItem.Type or something like that so if you noticed that an actual report item have value, lets say 1 and a mail item had value 2 you could skip over it?
0
 
LVL 4

Accepted Solution

by:
Jigit earned 1000 total points
ID: 11824709
Try the following:
foreach(Outlook.ReportItem oReport in oItems)
{
   if ( oReport is MailItem ) continue;
   Console.WriteLine(oReport.Subject);
}

What error are you getting? Maybe the error is Outlook security restriction?
There is a great developempent tool working around the security limitations of Outlook, called Outlook Redemption:
http://www.dimastr.com/redemption/

There is another tool of the same guy called Outlook Spy:
http://www.dimastr.com/outspy/
It displays all the properties/method/events/etc of any Outlook object and enables running scripts from Outlook itself. Very helpful for Outlook integration development.

HTH,
Jigit
0
 

Author Comment

by:SiraX
ID: 11825633
Jigit the loop won't work as oItems also can contain MailItems, at that moment you can't assign the Item to oReport as ReportItem.

In fact I resolved my problem ... I just do a for loop and work with GetNext in a try catch.

the other problem with the folder selection is also solved

I will split the points to you two as were the only ones who tried to help me out ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question