PC Review


Reply
Thread Tools Rate Thread

How to add a UserProperty to a MAPIFolder?

 
 
Jeff
Guest
Posts: n/a
 
      25th Oct 2006
I want to be able to use MAPIFolder.Items.Restrict() to return me a
collection of items that my program has not yet processed. After I
process items, I mark them w/ a custom string UserProperty that I set
to a GUID.

"If you are trying to use the Find or Restrict methods with
user-defined fields, the fields must be defined in the folder,
otherwise an error will occur."-MSDN
(http://msdn.microsoft.com/library/de...HV05247704.asp)

What is the proper way to add my UserProperty to the MAPIFolder such
that I can use the Restrict method to return me the results I'm looking
for?

What query string should I pass to Restrict() that would get me all
Items that are not marked w/ my string GUID?

Thanks!
Jeff

 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      25th Oct 2006
Create a new PostItem in the folder.
Add a property to it with UserProperties.Add. (The default is to add it to the folder as well)
Delete the PostItem.

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

"Jeff" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>I want to be able to use MAPIFolder.Items.Restrict() to return me a
> collection of items that my program has not yet processed. After I
> process items, I mark them w/ a custom string UserProperty that I set
> to a GUID.
>
> "If you are trying to use the Find or Restrict methods with
> user-defined fields, the fields must be defined in the folder,
> otherwise an error will occur."-MSDN
> (http://msdn.microsoft.com/library/de...HV05247704.asp)
>
> What is the proper way to add my UserProperty to the MAPIFolder such
> that I can use the Restrict method to return me the results I'm looking
> for?
>
> What query string should I pass to Restrict() that would get me all
> Items that are not marked w/ my string GUID?
>
> Thanks!
> Jeff
>

 
Reply With Quote
 
=?Utf-8?B?UCBIb3BwZQ==?=
Guest
Posts: n/a
 
      6th Nov 2006
What exactly need to be done to the MailItem for this to work?

I have the following code (C#):
dummyMailItem.UserProperties.Add("Dummy", Outlook.OlUserPropertyType.olText,
true, System.Type.Missing);
dummyMailItem.Subject = "Dummy";
dummyMailItem.Body = "Dummy";
dummyMailItem.To = "(E-Mail Removed)";
dummyMailItem.Save();
//dummyMailItem.Delete();

However, the mail item isn't added to the folder, and the user property
isn't added as user propertiy column.

Why not?

 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      6th Nov 2006
Create a PostItem in the folder, not a MailItem, and use True for the third parameter of UserProperties.Add.

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

"P Hoppe" <(E-Mail Removed)> wrote in message news:AB4F94F7-1E62-458F-A5FD-(E-Mail Removed)...
> What exactly need to be done to the MailItem for this to work?
>
> I have the following code (C#):
> dummyMailItem.UserProperties.Add("Dummy", Outlook.OlUserPropertyType.olText,
> true, System.Type.Missing);
> dummyMailItem.Subject = "Dummy";
> dummyMailItem.Body = "Dummy";
> dummyMailItem.To = "(E-Mail Removed)";
> dummyMailItem.Save();
> //dummyMailItem.Delete();
>
> However, the mail item isn't added to the folder, and the user property
> isn't added as user propertiy column.
>
> Why not?
>

 
Reply With Quote
 
=?Utf-8?B?UCBIb3BwZQ==?=
Guest
Posts: n/a
 
      8th Nov 2006
Thanks,

That Wasn't logical but it did the trick.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Userproperty question Ken Slovak - [MVP - Outlook] Microsoft Outlook VBA Programming 0 25th Feb 2010 02:25 PM
Exchange and UserProperty Jim Microsoft Outlook Program Addins 5 21st Nov 2005 06:17 PM
Is UserProperty what I need? Randy Harris Microsoft Outlook VBA Programming 4 16th Sep 2005 12:25 PM
Searching for UserProperty wizeguy Microsoft Outlook VBA Programming 1 15th Jul 2005 09:44 PM
UserProperty vs HTML lloyd christopher Microsoft Outlook Program Addins 3 4th Sep 2003 03:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.