A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Contacts
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

.NET Programmatically accessing Exchange shared and public folders



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 7th 06, 09:54 PM posted to microsoft.public.outlook.contacts
DeborahK
external usenet poster
 
Posts: 3
Default .NET Programmatically accessing Exchange shared and public folders

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!
Ads
  #2  
Old August 11th 06, 01:57 AM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default .NET Programmatically accessing Exchange shared and public folders

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/comm....program_v ba

--
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

"DeborahK" wrote in message ...
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!

  #3  
Old August 11th 06, 03:47 PM posted to microsoft.public.outlook.contacts
DeborahK
external usenet poster
 
Posts: 3
Default .NET Programmatically accessing Exchange shared and public fol

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.

"Sue Mosher [MVP-Outlook]" wrote:

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/comm....program_v ba

--
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

"DeborahK" wrote in message ...
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!


  #4  
Old August 11th 06, 10:42 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default .NET Programmatically accessing Exchange shared and public fol

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.

--
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

"DeborahK" wrote in message ...
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.

"Sue Mosher [MVP-Outlook]" wrote:

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/comm....program_v ba

"DeborahK" wrote in message ...
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!


  #5  
Old August 16th 06, 11:20 PM posted to microsoft.public.outlook.contacts
DeborahK
external usenet poster
 
Posts: 3
Default .NET Programmatically accessing Exchange shared and public fol

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!

"Sue Mosher [MVP-Outlook]" wrote:

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.

--
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

"DeborahK" wrote in message ...
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.

"Sue Mosher [MVP-Outlook]" wrote:

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/comm....program_v ba

"DeborahK" wrote in message ...
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!


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Public folders in 2003 or 2007 Nate Outlook - General Queries 3 June 8th 06 01:15 AM
Public Shared Folders for use With Shared Fax SBS 2003 DCA Outlook - Using Contacts 1 May 1st 06 11:34 PM
Shared Contacts in Public Folders Lasse Outlook - Using Contacts 2 March 31st 06 11:45 AM
Exchange public folders gary Outlook - Using Contacts 2 February 23rd 06 04:21 PM
Public holiday in shared folders Support Outlook - General Queries 5 January 18th 06 03:24 PM


All times are GMT +1. The time now is 06:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.