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 Forms / July 2004

Tip: Looking for answers? Try searching our database.

FIltering Contacts Folder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chad Gartner - 22 Jul 2004 18:12 GMT
Hi, I'm trying to figure out how to filter the card view list of
contacts on the main outlook window from a button within a custom form.
Right now it displays a whole new window with the contacts folder (i'd
like the current one to refresh ideally), but doesn't restrict by what I
want restricted. Do I have to use OVC in a custom window to do something
like this? I've searched the MSDN and outlook code site but havn't run
across anything similar, nor do I recall anything in my Outlook
Programming book.

Secondly, does anyone have a good reccomendation for a better
understanding of the object-oriented basis for programming in VB? I
understand most of the methods I know, I just usually have a tough time
knowing what other 1-5 things need to be initialized before you get
there. (I stink at object oriented programming I think.)
Thanks for looking!

-Chad

Here's my modified MS code for reference.

Sub ContactsByCategory()
   ' This procedure returns an Outlook ContactItem that matches the
   ' criteria specified in the arguments passed to the procedure.
   Dim fldFolder            As Outlook.MAPIFolder
   Dim objItemsCollection   As Object
   Dim objItem              As Object
   Dim objMatchingItem      As Object
   Dim strCriteria          As String
 
   On Error GoTo GetItem_End

   ' Use the InitializeOutlook procedure to initialize global
   ' Application and NameSpace object variables, if necessary.
   If gobjApp Is Nothing Then
       If InitializeOutlook = False Then
           MsgBox "Unable to initialize Outlook Application " & "or
NameSpace object variables!"
           Exit Sub
       End If
   End If

   Set fldFolder = gnspNameSpace.GetDefaultFolder(olFolderContacts)
 
   strCriteria = "[Categories] = 'Legal'"
 
   Set objItemsCollection = fldFolder.Items.Restrict(strCriteria)
 
   If objItemsCollection.Count > 0 Then
       fldFolder.Display
   End If

GetItem_End:
   Exit Sub
End Sub
Sue Mosher [MVP-Outlook] - 22 Jul 2004 19:05 GMT
Restrict does not affect the UI.

You didn't mention your Outlook version. If you're using OL2002 SP2 or
later, you can modify the <filter> element of the View.XML property.
Otherwise, you'd need to use the OVC in a folder home page.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Hi, I'm trying to figure out how to filter the card view list of
> contacts on the main outlook window from a button within a custom form.
[quoted text clipped - 50 lines]
>     Exit Sub
> End Sub
 
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.