![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#5
|
|||
|
|||
![]()
Hi Ken,
Thanks a lot for you interest. I tried to get All Pubilc Folders folder and i got the same Error: "Microsoft Exchange is not available. Either there are network problems or the Exchange computer is down for maintenance". At this point I think this is a problem of my Exchange 2007 installation ... I will try reinstalling the Dev environment and will let you know if got fixed ... .... but anyway ... since this "problem" may occur when Exchange is not available (i know it is strange in NON Cached Mode) how can i solve the foreach problem!? Since everything is started developing a VSTO 3SP1 c# Outlook Addin while I was trying to enumerates Stores ... and Application.Session.Stores is not an array of Outlook.Store but it is IEnumerable and can be accessed just with foreach (or equivalent) ... how can I enumerate all Stores with a for (int i=0;....) in order to put error handling on each item ?!? Thanks! Regards, Stefano "Ken Slovak - [MVP - Outlook]" wrote: I tested both code methods (with the For...Each and For loops) here on Outlook 2007 in both online and cached modes and ran the code with no errors. I got the display name for public folders with no errors. Let's try a couple of tests. First, when you iterate the stores get each one as a Store object. Make sure you can do that with the public folders store and as a Store object try to access DisplayName. Do that instead of using those compound dot operators (oNS.Stores(i).DisplayName). They make it hard to see exactly where the error is occurring. Second, try getting the All Public Folders folder using oNS.GetDefaultFolder(olPublicFoldersAllPublicFolde rs) and see if you get a valid Folder object and if you can access its properties such as Name. I'm amazed that this is happening in online mode, if anything I'd expect some problem with cached mode rather than online mode. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "stefanom74" wrote in message ... Hi Ken, Thanks for the reply. I found the problem ! I tried your code but it returns the same Automation Error (on "Next" statement), then i tried to change the code from "for each" to a simple (for index=1 to oNS.Count) ... and here it is !!! The "real" error appeared "Unable to connect Exchange...." while accessing to the DisplayName store's property (not on "Next i" statement). The error was on the "Public Folders" that is enumerated as store too! An error handling inside the "For" will probably "solve" the problem. (but why the "For Each" statement doesn't have the same behavior?) This is the update code: Sub TestBug() Dim store As store Dim oNS As Outlook.NameSpace Set oNS = Application.GetNamespace("MAPI") MsgBox (oNS.Stores.Count) '- this returns 3 For i = 1 To oNS.Stores.Count MsgBox (oNS.Stores(i).DisplayName) ' - this returns Error on i = 2 Next i End Sub Regards, Stefano |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Appointments and Cached Mode | Delores | Outlook - Calandaring | 1 | September 10th 08 08:56 PM |
Configure cached mode for additional mailboxes configured on a pro | Doria | Outlook - Installation | 0 | May 8th 08 01:51 PM |
Cached Mode for "Other Mailboxes" + Exchange | Hasan Sheriff[_2_] | Outlook - General Queries | 1 | January 17th 08 02:37 AM |
Outlook 2007 cached mode with additional mailboxes | [email protected] | Outlook - General Queries | 1 | August 13th 07 03:04 PM |
Unable to use out look with Cached Exchange Mode enabled | [email protected] | Outlook - General Queries | 6 | October 26th 06 03:00 AM |