Results 1 to 3 of 3

Thread: [2008] Read Mailboxes

  1. #1

    Thread Starter
    Hyperactive Member Jonny1409's Avatar
    Join Date
    Mar 2005
    Posts
    308

    [2008] Read Mailboxes

    Hello,

    I am after some code that will help me read several mailboxes on a particular server on the network and bring me back the date of the last mail within each one.

    Is this possible ?
    Where would I start ?

    Thank you.

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [2008] Read Mailboxes

    You would start by giving us more information what type of server is it and what kind of access do you have to the mailboxes?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Hyperactive Member Jonny1409's Avatar
    Join Date
    Mar 2005
    Posts
    308

    Re: [2008] Read Mailboxes

    Apologies Chris I'll try to explain a bit more.

    I don't know a grreat deal about the servers themselves, but what I can say is that the following code works in a current MS Access application we have.

    Obviously I need to convert this to VB.NET.

    Code:
    For Each mailbox In Mailboxes
            lblMessage.Caption = "Checking " & mailbox & " mailbox, please wait..."
            Set myRecipient = myNamespace.CreateRecipient(mailbox)
            myRecipient.Resolve
            If myRecipient.Resolved Then
                Set Inbox = myNamespace.GetSharedDefaultFolder(myRecipient, olFolderInbox)
                Set ProcessedFolder = Inbox.folders.GetFirst
                Do Until InStr(1, ProcessedFolder.Name, "Processed") <> 0
                    Set ProcessedFolder = Inbox.folders.GetNext
                    If ProcessedFolder Is Nothing Then
                        MsgBox "Unable to open Processed folder for " & UCase(mailbox), vbCritical, "Daily Checks"
                        Exit Sub
                    End If
                Loop
                Set item = ProcessedFolder.Items.GetFirst
            Else
                MsgBox "Unable to open " & UCase(mailbox) & " mailbox. Check manually.", vbExclamation, "Daily Checks"
            End If
            
            If InStr(1, LCase(mailbox), "zurich") <> 0 Then
                [Last ABC File Received] = Format(item.SentOn, "Short Date")
            ElseIf InStr(1, LCase(mailbox), "ABC") <> 0 Then
                [Last DEF File Received] = Format(item.SentOn, "Short Date")
            ElseIf InStr(1, LCase(mailbox), "DEF") <> 0 Then
                [Last GHI File Received] = Format(item.SentOn, "Short Date")
            ElseIf InStr(1, LCase(mailbox), "GHI") <> 0 Then
                [Last JKL File Received] = Format(item.SentOn, "Short Date")
            ElseIf InStr(1, LCase(mailbox), "JKL") <> 0 Then
                [Last MNO File Received] = Format(item.SentOn, "Short Date")
            ElseIf InStr(1, LCase(mailbox), "MNO") <> 0 Then
                [Last PQR File Received] = Format(item.SentOn, "Short Date")
            End If
        Next mailbox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width