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 / Programming Add-Ins / October 2007

Tip: Looking for answers? Try searching our database.

Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConnectio

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jochen - 29 Oct 2007 22:31 GMT
Hello out there,

my first VB6-add-in for Outlook 2003 does not work on all machines. If other
add-ins are loaded, it sometimes failes with an error "Client process could
not be completed".
The error occurs when in AddinInstance_OnConnection my add-in looks for a
certain folder.

  Dim oStores        As Outlook.Folders
  Dim oFolder        As Outlook.MAPIFolder
  Dim oSubFolder  As Outlook.MAPIFolder
  Dim sMyEntryID  As String

  Set oStores = oMyOLNameSpace.Folders
   For Each oFolder In oStores
      For Each oSubFolder In oFolder.Folders
         If oSubFolder.Name = "NeedThis" Then
            sMyEntryID = oSubFolder.EntryID
         End If
      Next oSubFolder
  Next oFolder

Is there anything wrong with looping through Outlook folders in
AddinInstance_OnConnection? Is this bad practice?
Thanks for your advice!
 Jochen
Michael Bauer [MVP - Outlook] - 30 Oct 2007 06:40 GMT
How dows the complete procedure look like?

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
 Synchronize Color Categories & Ensure that Every Item Gets Categorized:
 <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Mon, 29 Oct 2007 14:31:00 -0700 schrieb jochen:

> Hello out there,
>
[quoted text clipped - 22 lines]
> Thanks for your advice!
>   Jochen
jochen - 30 Oct 2007 14:20 GMT
This is a readable version of the procedure which sometimes showing error
"Client process could not be completed".

Meanwhile I have a better version of the add-in using Redemption's
GetSharedDefaultFolder-method. Nevertheless I'd like to know if my former
looping the folders in AddinInstance event is bad design? Maybe not all
Exchange folders are ready at this moment?
In this procedure I try to get the StoreIDs and EntryIDs of the user's
Sent-Item-folders (own plus delegate mailboxes).
The error occurs when trying to get the EntryID of an Exchange folder
(probably a Calendar). I do have sufficient rights and the error still
happens with some users only, not always and with all users.

Thanks for your advice!

 Regards,
  Jochen

-----------
Private Type UserSentFolder
   UserName As String
   FolderID As String
   StoreID  As String
End Type

Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
   ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
   ByVal AddInInst As Object, custom() As Variant)

   Dim oOLNameSpace      As Outlook.NameSpace
   Dim oStores           As Outlook.Folders
   Dim oFolder           As Outlook.MAPIFolder
   Dim oSubFolder        As Outlook.MAPIFolder
   Dim j                 As Long
   Dim sTempUserName     As String
   Dim sTempFolderName   As String

   
   Set oOLNameSpace = Application.GetNamespace("MAPI")
   Set oStores = oOLNameSpace.Folders

   For Each oFolder In oStores
       sTempUserName = oFolder.Name
           sTempUserName = Mid$(sTempUserName, 12) 'Text behind "Mailbox - "
                                                   '(in German "Postfach - ")
           For Each oSubFolder In oFolder.Folders
               sTempFolderName = oSubFolder.Name
               If (sTempFolderName = "Gesendete Elemente") Or _
                  (sTempFolderName = "Gesendete Objekte") Then
                   With m_udtUserSentFolders(j)
                       .UserName = sTempUserName
                       .FolderID = oSubFolder.EntryID '!!!Error occurs here
                       .StoreID = oSubFolder.StoreID
                   End With
                   j = j + 1
               End If
           Next oSubFolder
   Next oFolder

End Sub

> How dows the complete procedure look like?
>
[quoted text clipped - 26 lines]
> > Thanks for your advice!
> >   Jochen
 
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.