Creating a searchfolder with a userdefined column

J

Jay Pete

Hi Guys,

I am trying to create a plugin for Outlook 2007 using Visual Studio
2008.

I am trying to create a new userdefined field called ColorID on my
Inbox. I want this ColorId to be used to create a new Search Folder.
I
can do that using the code below. My problem is that I cannot get
Outlook to display the ColorID column in the Search Folder, and
subsequently group my search result by this column (a thing I can't
do
manually in Outlook either by the way).

That's my first problem. I also want to enable in cell editing on
this
Search Folder.

My next wish for this is that I want to add a little icon in the
column that shows the actual color of the ColorID I have added. Is it
possible to have two different views of the cell when the edit cursor
is in the cell and when it isn't. I'd like to be able to just write 2
for the color green for example, and then have it show up as a green
icon when the cell is no longer in editmode.

Can anyone point me towards a place where I can see how this is done
or show me? It would be greately appreciated! I have spent the last
three days trying to find a solution on the MSDN website without
finding a solution.

Thanks, Jay


---==CODE START==---
//Get folder object
Outlook.Folder folder =
Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox-)
as Outlook.Folder;

//Add ColorID user definied property
folder.UserDefinedProperties.Add("ColorID",
Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);

//Create Search Folder
string Scope = "'Inbox'";
string Criteria = "http://schemas.microsoft.com/mapi/string/
{00020329-0000-0000-C000-000000000046}/ColorID ci_phrasematch '2'";

Outlook.Search sFolder = Application.AdvancedSearch(Scope, Criteria,
Type.Missing, Type.Missing);

//Save search folder
sFolder.Save("Test");
---==CODE END==---
 

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