Read Emails on Exchange server without OL client

  • Thread starter Bryan Dickerson
  • Start date
B

Bryan Dickerson

Is there a way, with VS 2005 and FX 2.0, to read a given inbox? I need to
write a 'monitor' program and my boss is convinced, as is always his first
gut reaction, that we need to go buy a 3rd-party package to just read an
inbox. He may be right this time, but that's not usually my first gut
reaction--we've had too many good employees around here fired 'cause they
spent too much money on albatross software (another soapbox, sorry). I need
to write this monitor program in a very generic way, i.e. without Outlook
interfaces, but surely there's a generic way to do it with the FX 2.0,
right?

TIA!
 
B

Bryan Dickerson

I, and my boss, were thinking of just writing a program to run on a
scheduled task about every 10 minutes to monitor this certain inbox. Is
there something in the Framework to just read, generically, of course, the
basic information about an inbox item? For example, I want to read all the
items in the inbox and see if there is anything there that is older than 10
minutes (these people are paranoid) and just send off an email alert to one
or more people based on what I find. I don't know if I want to go writing
Event Sinks, but perhaps that would be what it takes. It just seems that
this is almost too generic of a task to do to go and spend money on a TPP
that just reads an inbox. I could do that in VB6 without Outlook hooks and
without spending any money (in fact, I did it about 3 years ago).

vbnetdev said:
 
V

vbnetdev

There is but I need to think about this. I hope you have some time. It will
take some doing.

Kelly

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Bryan Dickerson said:
I, and my boss, were thinking of just writing a program to run on a
scheduled task about every 10 minutes to monitor this certain inbox. Is
there something in the Framework to just read, generically, of course, the
basic information about an inbox item? For example, I want to read all the
items in the inbox and see if there is anything there that is older than
10 minutes (these people are paranoid) and just send off an email alert to
one or more people based on what I find. I don't know if I want to go
writing Event Sinks, but perhaps that would be what it takes. It just
seems that this is almost too generic of a task to do to go and spend
money on a TPP that just reads an inbox. I could do that in VB6 without
Outlook hooks and without spending any money (in fact, I did it about 3
years ago).
 
J

John A. Bailo

vbnetdev said:
There is but I need to think about this. I hope you have some time. It will
take some doing.

Kelly

Well, I wish someone knew.

Microsoft literature states that Office should not be used for
background automation (only enhancing the client driven UI).

But what is to be used for these kinds of tasks remains unanswered?

In theory, Exchange is a database, with highly structured objects.

I should be able to log into it, read and manipulate these objects with
a server connection, either via an API or through some type of SOAP
protocol.
 
B

Bryan Dickerson

This looks awfully close to what I need. I will be anxious to see Kelly's
response as well, but this looks real good.

Thanx!
 
J

jayeldee

I've written a similar program in VS 2003 that gathers a few statistics
about Exchange users using Redemption Objects which you can find at
http://dimastr.com/redemption/ . Saved me a lot of time and effort and
if I'm not mistaken, doesn't cost anything as long as you aren't
distributing it in a commercial product. It's a COM library which may
or may not be what you were looking for. I haven't used 2005 myself
and I'm not familiar how it does COM interop.
 
V

vbnetdev

Bryan,

still working on your issue. Would you say a mailbox greater than the size
of 0 would want your attention?

Kelly
 
V

vbnetdev

Imports System
Imports System.Management
Imports System.Windows.Forms

Namespace VIKINGSSUCK

Public Class THEPACKERSROCK

Function HELPMENOW()

Dim searcher As New ManagementObjectSearcher( _
"root\MicrosoftExchangeV2", _
"SELECT * FROM Exchange_Mailbox WHERE MailboxDisplayName
= 'Joe Schmo'")

For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("MailboxDisplayName: {0}",
queryObj("MailboxDisplayName"))
Console.WriteLine("Size: {0}", queryObj("Size"))
Console.WriteLine("TotalItems: {0}",
queryObj("TotalItems"))
Next
'if size or totalitems > 0 Then send an email to somebody here.

End Function
End Class
End Namespace
 
B

Bryan Dickerson

I'll give this a shot.

vbnetdev said:
Imports System
Imports System.Management
Imports System.Windows.Forms

Namespace VIKINGSSUCK

Public Class THEPACKERSROCK

Function HELPMENOW()

Dim searcher As New ManagementObjectSearcher( _
"root\MicrosoftExchangeV2", _
"SELECT * FROM Exchange_Mailbox WHERE
MailboxDisplayName = 'Joe Schmo'")

For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("MailboxDisplayName: {0}",
queryObj("MailboxDisplayName"))
Console.WriteLine("Size: {0}", queryObj("Size"))
Console.WriteLine("TotalItems: {0}",
queryObj("TotalItems"))
Next
'if size or totalitems > 0 Then send an email to somebody here.

End Function
End Class
End Namespace
 
B

Bryan Dickerson

I guess I don't follow...

vbnetdev said:
Bryan,

still working on your issue. Would you say a mailbox greater than the size
of 0 would want your attention?

Kelly
 
V

vbnetdev

Maybe I got your posts out of order.

You don't follow this code sample? Did you reference System.Management?
 
V

vbnetdev

replace below with

MsgBox(queryObj("Size"))

MsgBox(queryObj("TotalItems"))


replace this. I am sorry doing it on the fly.

Console.WriteLine("MailboxDisplayName: {0}",
queryObj("MailboxDisplayName"))
Console.WriteLine("Size: {0}", queryObj("Size"))
Console.WriteLine("TotalItems: {0}",
queryObj("TotalItems"))
 
B

Bryan Dickerson

I saw your other post doing the SELECT from Exchange_Mailbox and answered
that one. Where do you go to find the field names that Exchange uses?
 
V

vbnetdev

I am not sure what you are asking.

Did the code sample solve your dilemma if knowing if the mailbox is empty?

Kelly
 
B

Bryan Dickerson

I'm getting "Invalid Namespace" from the System.Management namespace. What
am I not doing right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top