Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Using C# to create a user-defined field? (http://www.outlookbanter.com/add-ins-outlook/43973-using-c-create-user-defined.html)

Mikael March 21st 07 01:24 PM

Using C# to create a user-defined field?
 
Hi!


I am coding a solution that has a function to sync it's database with
Outlook. I use a User-Defined Field to keep track of "my" items and it works
great. BUT - I can not find a way to add the user-defined field to the
folder programmatically. If an app is to be distributet widely I can't ask
my users to do this by hand.

I have noticed that som apps (like Skype) has added user-defined fields
automatically, so there has to be a way - do you know or could you point me
in the right direction? I'm coding in C# and Visual Studio 2005.

Regards
Mikael
Sweden

(I was unsure if this should be published in Interop or Program_AddIns)



Ken Slovak - [MVP - Outlook] March 21st 07 01:40 PM

Using C# to create a user-defined field?
 
Answered in Interop, although this is a better group for a question like
that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Mikael" wrote in message
...
Hi!


I am coding a solution that has a function to sync it's database with
Outlook. I use a User-Defined Field to keep track of "my" items and it
works great. BUT - I can not find a way to add the user-defined field to
the folder programmatically. If an app is to be distributet widely I can't
ask my users to do this by hand.

I have noticed that som apps (like Skype) has added user-defined fields
automatically, so there has to be a way - do you know or could you point
me in the right direction? I'm coding in C# and Visual Studio 2005.

Regards
Mikael
Sweden

(I was unsure if this should be published in Interop or Program_AddIns)




j March 23rd 07 07:01 PM

Using C# to create a user-defined field?
 
If u want add fields to folder, u should create mailItem fill it with
properties and move to folder, that's all.


Sue Mosher [MVP-Outlook] March 23rd 07 07:17 PM

Using C# to create a user-defined field?
 
If u want add fields to folder, u should create mailItem fill it with
properties and move to folder, that's all.


That would be totally ineffective. Moving an item to a folder has no effect whatsoever on the fields defined in that folder.

To define a field in a folder in versions before Outlook 2007, use the MAPIFolder.Items.Add method to create a new item in the folder (a post item if it's a mail/post folder). Then use the item's UserProperties.Add method to create the property on the item, setting the third parameter to True. Finally, delete this new item, which is no longer needed.

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



All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com