Using Outlook View Control to display search results ...

N

Nick

I am trying to build an application that helps users
search multiple folders in Outlook (like Inbox & Sent
Items) at the same time for some custom properties, and
display the results in the Outlook View Control.

However, I have found that there seems to be no way of
making the View Control support multiple folders. It
forces me to set a folder, and then allows searches on
that folder only.

Can anybody tell me what is the best way for searching
for content across folders and then displaying it?

Thanks
--Nirav
 
K

Ken Slovak - [MVP - Outlook]

I usually use a grid control and put the information in there. I set
up 2 invisible columns in the gird for the EntryID and StoreID for
each item so if a row is double-clicked I can open the original item
using NameSpace.GetItemFromID

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

Nick

Using your own grid amounts to losing all the
functionality on the View Control. Do you know of some
other control or mechanism that can display the correct
icons, differentiate between read/unread messages, use the
correct view etc?

--Nick
-----Original Message-----
I usually use a grid control and put the information in there. I set
up 2 invisible columns in the gird for the EntryID and StoreID for
each item so if a row is double-clicked I can open the original item
using NameSpace.GetItemFromID

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


Nick said:
I am trying to build an application that helps users
search multiple folders in Outlook (like Inbox & Sent
Items) at the same time for some custom properties, and
display the results in the Outlook View Control.

However, I have found that there seems to be no way of
making the View Control support multiple folders. It
forces me to set a folder, and then allows searches on
that folder only.

Can anybody tell me what is the best way for searching
for content across folders and then displaying it?

Thanks
--Nirav


.
 
K

Ken Slovak - [MVP - Outlook]

M

Martin

Ken,

could you post (or send a email with) a example using the grid control?

Thx Martin


Ken Slovak - said:
I usually use a grid control and put the information in there. I set
up 2 invisible columns in the gird for the EntryID and StoreID for
each item so if a row is double-clicked I can open the original item
using NameSpace.GetItemFromID

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


Nick said:
I am trying to build an application that helps users
search multiple folders in Outlook (like Inbox & Sent
Items) at the same time for some custom properties, and
display the results in the Outlook View Control.

However, I have found that there seems to be no way of
making the View Control support multiple folders. It
forces me to set a folder, and then allows searches on
that folder only.

Can anybody tell me what is the best way for searching
for content across folders and then displaying it?

Thanks
--Nirav
 
K

Ken Slovak - [MVP - Outlook]

Here's some code that populates a grid control with mail items from 1
folder. It can easily be modified to get mail item collections from
other folders and add those items to the grid also: The code runs in
the Item_Open event handler of the form:

Set oNS = Application.GetNamespace("MAPI")
Set oMailFolder = oNS.Folders("MRC")
Set oMailItems = oMailFolder.Items
Set oPage = Item.GetInspector.ModifiedFormPages("Doctors Desktop")

Set oCtrl = oPage.Controls("grdMailItems") 'grid control (HFlex)
With oCtrl
.Rows = 1
.RowHeightMin = 400
.Width = 350
.Height = 140
.FormatString = "<DateTime Stamp|<Subject|<"
.cols = 3
.ColWidth(0) = 1550 'DateTime Stamp
.ColWidth(1) = 5350 'Subject
.ColWidth(2) = 0 'EntryID

For Each obj In oMailItems
sDate = CStr(obj.ReceivedTime)
sType = obj.Subject
sEntryID = obj.EntryID
sAdd = sDate & vbTab & sType & vbTab & sEntryID

.AddItem sAdd
Next
.col = 0
.ColSel = .col
.Sort = 1
End With

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top