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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConnectio



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 29th 07, 10:31 PM posted to microsoft.public.outlook.program_addins
jochen[_2_]
external usenet poster
 
Posts: 2
Default Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConnectio

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

  #2  
Old October 30th 07, 06:40 AM posted to microsoft.public.outlook.program_addins
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConnectio



How dows the complete procedure look like?

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

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

  #3  
Old October 30th 07, 02:20 PM posted to microsoft.public.outlook.program_addins
jochen[_2_]
external usenet poster
 
Posts: 2
Default Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConne

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



"Michael Bauer [MVP - Outlook]" wrote:



How dows the complete procedure look like?

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

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


 




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
Enable/Disable Macros when walking public folders in loop Matt Williamson Outlook and VBA 3 May 4th 07 04:28 PM
Outlook 2002 Test Message In Loop Jon Outlook - General Queries 1 July 22nd 06 12:45 AM
Loop through all folders in a mailbox Bob Smith Outlook and VBA 4 May 26th 06 12:23 AM
Hide/Delete Deleted Items & Search Folders Folders in Outlook 2003 jpspringall Outlook and VBA 1 April 24th 06 03:51 PM
How to loop through Outlook tasks in VBA Rick Williams Outlook and VBA 2 January 25th 06 08:59 PM


All times are GMT +1. The time now is 08:39 PM.


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.