Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem accessing public folder via vba

Posted on 2004-09-15
3
Medium Priority
?
389 Views
Last Modified: 2010-04-08
I'm trying to get access to our public folder using vba in Outlook.  Our system is connected to an exchange server.  The public folder is outside of my account.  So for example when i open outlook i have my mail box called "x Personal Email" and on the same level there is a folder called "Public Folders" so its not in my personal email but at the same level.  The public folder is a company wide public folder that everyone has access to.  I goal is to write a tool that reads this a particular sub-folder specific to my project and process the undeliverable emails.

Here is my code:

    Set objApp = New Outlook.Application
    Set objNameSpace = objApp.GetNamespace(Type:="MAPI")
    Set objMAPIFolder = _
        objNameSpace.GetDefaultFolder(FolderType:=olPublicFoldersAllPublicFolders) _
        .Folders("Public Folders") _
        .Folders("All Public Folders").Folders("Company").Folders("Undeliverable Letters")
       

   
    For Each objMailItem In objMAPIFolder.Items
        ' Uncomment the next line if you want to verify results.
        ' Debug.Print objMailItem.SentOn & vbTab & _
            objMailItem.Subject
       
        If objMailItem.SentOn < Date Then
            lngOldMailCounter = lngOldMailCounter + 1
        Else
            lngNewMailCounter = lngNewMailCounter + 1
        End If
   
    Next objMailItem

But i fail right when i step over objMAPIFolder .

I'm sure i'm doing something wrong but can anyone guide me in fixing this problem.

THanks

0
Comment
Question by:borg48
[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
  • 2
3 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 12070369
what is the exact error message?
0
 

Author Comment

by:borg48
ID: 12070419
Could not complete the operation.  One or more parameter values are not valid.

But if i just put the first folder "Public Folders" i get the same error.  So i think its the root folder that i'm not getting correct.
0
 
LVL 44

Accepted Solution

by:
bruintje earned 320 total points
ID: 12070468
last post for today

maybe you find something useful in here
source : http://tinyurl.com/4gha5

it scetches a likewise problem and the solution was use your own const dimmed as long to substitute for early binding constants of the outlook object itself you could try this for the olPublicFoldersAllPublicFolders etc.....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

719 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