Search Multiple Public Folders 
Author Message
 Search Multiple Public Folders

I have the need to figure out how to search multiple
Public Folders. I need to iterate through a specific
Public Folder, retreive the names of the folders within
that folder and display this in a multi-selectable
listbox. I have read through SlipStick's site, bought what
I think is Sue Mosher's latest book (taught me plenty...
head full all the way to the bottom) and have still been
unable to connect the dots. My code is flawed and the
paint is still wet on my undertanding of how to fix it
(two weeks of pouring through Sue's book and this is where
I am)

Here is my attempt:

Private Sub UserForm_Initialize()
    Dim objApp As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim colFolders As Outlook.MAPIFolder
    Dim objFolder As Outlook.Folders
    Dim strSalesList As String ' used later for the
multiselect list
    Dim intTempo As Integer
    intTempo = 0
    Set objApp = CreateObject("Outlook.Application")
    Set objNS = objApp.GetNamespace("MAPI")
    Set colFolders = objNS.Folders.Item("Public Folders").
_
                    Folders.Item("All Public Folders"). _
                    Folders.Item("Marketing Leads"). _
                   Folders.Item("California")
    For Each objFolder In colFolders
    ' Step through the folders and show something like a
count to see if it works
    ' before I try to attach a FolderName to a variable
        intTempo = intTempo + 1
        strListOfSalesSearch.AddItem (intTempo)
    Next
    Set objApp = Nothing
    Set objNS = Nothing
    Set colFolders = Nothing
End Sub

Head hurts, must lay down.

Thanks, folks, for your time.

Larry



Sat, 29 Oct 2005 09:02:25 GMT  
 Search Multiple Public Folders
If colFolders.Folders.Count <> 0 Then
    For Each objFolder In ColFolders
        strName = objFolder.Name
    Next
End If

If the folders within the folder might also have subfolders I'd do it
as a function and call it recursively until there were no more
subfolders.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> I have the need to figure out how to search multiple
> Public Folders. I need to iterate through a specific
> Public Folder, retreive the names of the folders within
> that folder and display this in a multi-selectable
> listbox. I have read through SlipStick's site, bought what
> I think is Sue Mosher's latest book (taught me plenty...
> head full all the way to the bottom) and have still been
> unable to connect the dots. My code is flawed and the
> paint is still wet on my undertanding of how to fix it
> (two weeks of pouring through Sue's book and this is where
> I am)

> Here is my attempt:

> Private Sub UserForm_Initialize()
>     Dim objApp As Outlook.Application
>     Dim objNS As Outlook.NameSpace
>     Dim colFolders As Outlook.MAPIFolder
>     Dim objFolder As Outlook.Folders
>     Dim strSalesList As String ' used later for the
> multiselect list
>     Dim intTempo As Integer
>     intTempo = 0
>     Set objApp = CreateObject("Outlook.Application")
>     Set objNS = objApp.GetNamespace("MAPI")
>     Set colFolders = objNS.Folders.Item("Public Folders").
> _
>                     Folders.Item("All Public Folders"). _
>                     Folders.Item("Marketing Leads"). _
>                    Folders.Item("California")
>     For Each objFolder In colFolders
>     ' Step through the folders and show something like a
> count to see if it works
>     ' before I try to attach a FolderName to a variable
>         intTempo = intTempo + 1
>         strListOfSalesSearch.AddItem (intTempo)
>     Next
>     Set objApp = Nothing
>     Set objNS = Nothing
>     Set colFolders = Nothing
> End Sub

> Head hurts, must lay down.

> Thanks, folks, for your time.

> Larry



Sat, 29 Oct 2005 23:43:53 GMT  
 Search Multiple Public Folders

Quote:
>-----Original Message-----
>If colFolders.Folders.Count <> 0 Then
>    For Each objFolder In ColFolders
>        strName = objFolder.Name
>    Next
>End If

>If the folders within the folder might also have

subfolders I'd do it
Quote:
>as a function and call it recursively until there were no
more
>subfolders.

>--
>Ken Slovak
>[MVP - Outlook]
>http://www.slovaktech.com
>Lead Author, Professional Outlook 2000 Programming, Wrox
Press
>Lead Author, Beginning VB 6 Application Development, Wrox
Press
>Attachment Options
>http://www.slovaktech.com/attachmentoptions.htm
>Extended Reminders
>http://www.slovaktech.com/extendedreminders.htm



>> I have the need to figure out how to search multiple
>> Public Folders. I need to iterate through a specific
>> Public Folder, retreive the names of the folders within
>> that folder and display this in a multi-selectable
>> listbox. I have read through SlipStick's site, bought
what
>> I think is Sue Mosher's latest book (taught me plenty...
>> head full all the way to the bottom) and have still been
>> unable to connect the dots. My code is flawed and the
>> paint is still wet on my undertanding of how to fix it
>> (two weeks of pouring through Sue's book and this is
where
>> I am)

>> Here is my attempt:

>> Private Sub UserForm_Initialize()
>>     Dim objApp As Outlook.Application
>>     Dim objNS As Outlook.NameSpace
>>     Dim colFolders As Outlook.MAPIFolder
>>     Dim objFolder As Outlook.Folders
>>     Dim strSalesList As String ' used later for the
>> multiselect list
>>     Dim intTempo As Integer
>>     intTempo = 0
>>     Set objApp = CreateObject("Outlook.Application")
>>     Set objNS = objApp.GetNamespace("MAPI")
>>     Set colFolders = objNS.Folders.Item("Public
Folders").
>> _
>>                     Folders.Item("All Public Folders").
_
>>                     Folders.Item("Marketing Leads"). _
>>                    Folders.Item("California")
>>     For Each objFolder In colFolders
>>     ' Step through the folders and show something like a
>> count to see if it works
>>     ' before I try to attach a FolderName to a variable
>>         intTempo = intTempo + 1
>>         strListOfSalesSearch.AddItem (intTempo)
>>     Next
>>     Set objApp = Nothing
>>     Set objNS = Nothing
>>     Set colFolders = Nothing
>> End Sub

>> Head hurts, must lay down.

>> Thanks, folks, for your time.

>> Larry

>.
>No kidding? I was that close? ::runs off to try it::

Thanks, Mr. Slovak. Your book, Professional Outlook
Programming, has been helpful, as well.

Will see how it goes and post the results in this forum.

Larry



Sun, 30 Oct 2005 00:15:21 GMT  
 Search Multiple Public Folders

Quote:
>-----Original Message-----

>>-----Original Message-----
>>If colFolders.Folders.Count <> 0 Then
>>    For Each objFolder In ColFolders
>>        strName = objFolder.Name
>>    Next
>>End If

>>If the folders within the folder might also have
>subfolders I'd do it
>>as a function and call it recursively until there were
no
>more
>>subfolders.

>>--
>>Ken Slovak
>>[MVP - Outlook]
>>http://www.slovaktech.com
>>Lead Author, Professional Outlook 2000 Programming, Wrox
>Press
>>Lead Author, Beginning VB 6 Application Development,
Wrox
>Press
>>Attachment Options
>>http://www.slovaktech.com/attachmentoptions.htm
>>Extended Reminders
>>http://www.slovaktech.com/extendedreminders.htm



>>> I have the need to figure out how to search multiple
>>> Public Folders. I need to iterate through a specific
>>> Public Folder, retreive the names of the folders within
>>> that folder and display this in a multi-selectable
>>> listbox. I have read through SlipStick's site, bought
>what
>>> I think is Sue Mosher's latest book (taught me
plenty...
>>> head full all the way to the bottom) and have still
been
>>> unable to connect the dots. My code is flawed and the
>>> paint is still wet on my undertanding of how to fix it
>>> (two weeks of pouring through Sue's book and this is
>where
>>> I am)

>>> Here is my attempt:

>>> Private Sub UserForm_Initialize()
>>>     Dim objApp As Outlook.Application
>>>     Dim objNS As Outlook.NameSpace
>>>     Dim colFolders As Outlook.MAPIFolder
>>>     Dim objFolder As Outlook.Folders
>>>     Dim strSalesList As String ' used later for the
>>> multiselect list
>>>     Dim intTempo As Integer
>>>     intTempo = 0
>>>     Set objApp = CreateObject("Outlook.Application")
>>>     Set objNS = objApp.GetNamespace("MAPI")
>>>     Set colFolders = objNS.Folders.Item("Public
>Folders").
>>> _
>>>                     Folders.Item("All Public
Folders").
>_
>>>                     Folders.Item("Marketing Leads"). _
>>>                    Folders.Item("California")
>>>     For Each objFolder In colFolders
>>>     ' Step through the folders and show something like
a
>>> count to see if it works
>>>     ' before I try to attach a FolderName to a variable
>>>         intTempo = intTempo + 1
>>>         strListOfSalesSearch.AddItem (intTempo)
>>>     Next
>>>     Set objApp = Nothing
>>>     Set objNS = Nothing
>>>     Set colFolders = Nothing
>>> End Sub

>>> Head hurts, must lay down.

>>> Thanks, folks, for your time.

>>> Larry

>>.
>>No kidding? I was that close? ::runs off to try it::
>Thanks, Mr. Slovak. Your book, Professional Outlook
>Programming, has been helpful, as well.

>Will see how it goes and post the results in this forum.

>Larry
>.
>Was able to iterate through folders using that code.

Thanks.


Sat, 05 Nov 2005 02:35:53 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Search Public Folders - recurse through folders

2. VB to Search through Public Folder and Delete Item

3. "Fuzzy" searching of public folders

4. How can i search on More Public folder?

5. public folder - search function

6. How to search for publics folder within VBA

7. Searching within public folders

8. Copying from multiple Public Folders

9. Advanced FInd Can't Search Multiple Contact Folders in Another Users Contact Tree or in Public Folders

10. Syncing public folders with local folders automatically

11. How can I get/guess email address of a folder under the Public Folder

12. Public Folder Contact folders.

 

 
Powered by phpBB® Forum Software