Add button

Add-in Express™ Support Service
That's what is more important than anything else

Add button
 
James Samuel Samuel




Posts: 26
Joined: 2010-05-18
Sir,
I am doing an add-in project in OUTLOOK, I need to add a button in mail item grid just like the 'flag' ...
Posted 15 Jun, 2010 23:49:36 Top
Andrei Smolin


Add-in Express team


Posts: 17239
Joined: 2006-05-11
Hello James,

I suppose you are talking about adding a custom column to the grid of items in the Outlook Explorer window. If so, please check UserProperties.Add Method (Microsoft.Office.Interop.Outlook) and UserProperties.Add Method (Outlook Developer Reference).

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jun, 2010 07:44:38 Top
James Samuel Samuel




Posts: 26
Joined: 2010-05-18
Sir,
I have used the following code to generate user property for my mail.... there is no exception onthis code.. But i didn't see the userproperty that created by me... help me sir...

using OutLook = Microsoft.Office.Interop.Outlook;
private void AddinModule_AddinStartupComplete(object sender, EventArgs e)
{
OutLook._Application outlookobj3 = new OutLook.Application();
OutLook.MAPIFolder mapiF = (OutLook.MAPIFolder)outlookobj3.Session.Folders["Test"];
OutLook.MAPIFolder mapiF2 = (OutLook.MAPIFolder)mapiF.Folders["inbox"];
OutLook.MailItem newMItem = (OutLook.MailItem)outlookobj3.CreateItem(OutLook.OlItemType.olMailItem);
newMItem.Subject = "Testing mail";
newMItem.Body = "Body of the mail";
newMItem.To = "to@gmail.com";
newMItem.UserProperties.Add("Property", OutLook.OlUserPropertyType.olYesNo,true,Missing.Value) ;
newMItem.ItemProperties["Property"].Value = true;
newMItem.Save();
newMItem.Move(mapiF2);
}
Posted 17 Jun, 2010 23:51:59 Top
Andrei Smolin


Add-in Express team


Posts: 17239
Joined: 2006-05-11
Hello James,

That UserProperty is added to the list of fields available for that folder. But you need to add that column to the view, in Outlook 2007 see View | Current View | Customize Current View | Fields | "Select available fields from:" User-defined fields in folder. To add that column to the view programmatically, you need to study View.XML before and after adding that column in the UI.

Also, see Creating Custom Views and View.XML Property.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Jun, 2010 00:31:31 Top