Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Contacts / August 2006

Tip: Looking for answers? Try searching our database.

.NET Programmatically accessing Exchange shared and public folders

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DeborahK - 07 Aug 2006 21:54 GMT
I am trying to programmatically access Exchange shared and public folders via
Outlook from a .NET application.

Here is the line of code that is generating an error:

Dim olns As Outlook.NameSpace = OutlookInstance.GetNamespace("MAPI")
mapiFolder = olns.GetFolderFromID(folderID, storeID)

The error is:
"The messaging interface has returned an unknown error. If the problem
persists, restart Outlook".

I don't get the error message when accessing the user's default mailbox. I
also don't get the error message if the user manually opens Outlook before
using my application.

The application is correctly loading Outlook using:
                   ' Create the instance of outlook
                   _OL = New Outlook.Application
I know this because I can see Outlook being added to the Task Manager.

I have been struggling with this for days so if anyone has ideas I would
appreciate them.

THANKS!
Sue Mosher [MVP-Outlook] - 11 Aug 2006 01:57 GMT
If Outlook hasn't been started yet, you can use the Namespace.Logon method to start it with a particular mail profile.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public
.outlook.program_vba


Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

>I am trying to programmatically access Exchange shared and public folders via
> Outlook from a .NET application.
[quoted text clipped - 21 lines]
>
> THANKS!
DeborahK - 11 Aug 2006 15:47 GMT
Hi Sue -

Thank you for replying to my question. We tried that with several different
types of parameters (no parameters, all parameters, etc) and that did not
help. It still generates an error on the GetFolderFromID statement.

> If Outlook hasn't been started yet, you can use the Namespace.Logon method to start it with a particular mail profile.
>
[quoted text clipped - 25 lines]
> >
> > THANKS!
Sue Mosher [MVP-Outlook] - 11 Aug 2006 22:42 GMT
If Outlook isn't running, you'd want to use either

   olns.Logon "profile_name", "", False, True

or possibly

   olns.Logon "", "", True, True

This is a standalone Windows application? Check to see whether your anti-virus client has script blocking turned on.

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

> Hi Sue -
>
[quoted text clipped - 31 lines]
>> >
>> > THANKS!
DeborahK - 16 Aug 2006 23:20 GMT
Hi Sue -

Thanks again for replying. Just wanted you to know that we figured this out.
In case someone else runs into this - here is what we found:

- The storeID is critical to accessing any shared or public folders - but
only the first time in a session. There was one place in the code that was
messing up the store ID. Oddly enough, the store ID does NOT matter in the
following cases:
(1) Outlook has previously been opened.
(2) The user had followed a path in the code that referenced the folder with
a store ID.

But it *does* matter if Outlook has not been opened and this is the first
time accessing the folder.

Once we got the storeID to be correct in all paths of the code - everything
worked fine...

Thanks again for your assistance!

> If Outlook isn't running, you'd want to use either
>
[quoted text clipped - 41 lines]
> >> >
> >> > THANKS!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.