It looks to me like you're making this too hard. Your code gets the IDs from the current folder, then gets the same current folder again using GetFolderFromID. Why not cut out the extra steps and just use:

pippo = CurExplorer.CurrentFolder.Items

I've never heard of or seen a blank StoreID for any store.

Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54

"af2604" <af2604@yahoo.it> wrote in message news:OYqJSCNxIHA.1440@TK2MSFTNGP05.phx.gbl...
> Hi all.
> I'm trying to develop an AddIn using Visual Syudio 2008 Visual Basic,
> for Outlokk 2007.
> I'm able to detect the "SelectionChange" event for the current explorer,
> the program work fine, but the problem is that I have an IMAP account
> and so 2 different PST files : OUTLOOK.PST and IMAP.PST
>
> As soon as the program start it correctly detect that I'm working on the
> OUTLOOK.PST default file.
>
> But if I change selection and go in the "send folder" of Imap account
> I'm able to see the corrent user name : my.user@imap.xxx but I'M NOT
> ABLE TO DETECT THE CORRECT PST FILE.
>
> What I use to do this is :
> -----------------------------------------------------------------------
> Public WithEvents CurExplorer As Outlook.Explorer
>
> Private Sub CurExplorer_Activate() Handles _
> CurExplorer.SelectionChange
>
> Dim CurFldName As String
> Dim CurFldPath As String
> Dim CurUser As String
> Dim CurEntryId As String
> Dim CurStoreId As String
> Dim i As Integer
>
> CurUser = Me.Application.Session.CurrentUser.Address
>
> CurFldName = CurExplorer.CurrentFolder.Name
> CurFldPath = CurExplorer.CurrentFolder.Store.FilePath
> CurEntryId = CurExplorer.CurrentFolder.EntryID
> CurStoreId = CurExplorer.CurrentFolder.StoreID
>
> pippo = Me.Application.GetNamespace("MAPI"). _
> GetFolderFromID(CurEntryId, CurStoreId).Items
>
>
> End Sub
> ------------------------------------------------------------------------
> when I'm using OUTLOOK.PST file all is ok but when I select a IMAP
> folder the CurStoreId is always empty
>
> Any idea ?
>
> Alberto
02 JunStore.FilePath problem.af2604
03 Jun\ Re: Store.FilePath problem.Sue Mosher [MVP-Outlook]
03 Jun   \ Re: Store.FilePath problem.af2604
03 Jun      \ Re: Store.FilePath problem.af2604
All times are in (US) Eastern Daylight Time (GMT -4:00)