A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to add a UserProperty to a MAPIFolder?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 25th 06, 11:16 PM posted to microsoft.public.outlook.program_vba
Jeff
external usenet poster
 
Posts: 41
Default How to add a UserProperty to a MAPIFolder?

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

  #2  
Old October 25th 06, 11:24 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to add a UserProperty to a MAPIFolder?

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" wrote in message ups.com...
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

  #3  
Old November 7th 06, 12:03 AM posted to microsoft.public.outlook.program_vba
P Hoppe
external usenet poster
 
Posts: 3
Default How to add a UserProperty to a MAPIFolder?

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 = ";
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?

  #4  
Old November 7th 06, 12:26 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default How to add a UserProperty to a MAPIFolder?

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" wrote in message ...
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 = ";
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?

  #5  
Old November 8th 06, 11:10 PM posted to microsoft.public.outlook.program_vba
P Hoppe
external usenet poster
 
Posts: 3
Default How to add a UserProperty to a MAPIFolder?

Thanks,

That Wasn't logical but it did the trick.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AdvancedSearch on Userproperty 'Metro' of Custom contact form 'MyContact'. [email protected] Outlook - General Queries 0 April 28th 06 04:47 PM
Determine if a Folder contains a UserProperty Rog Add-ins for Outlook 3 April 10th 06 06:54 PM
MapiFolder Items ItemChange is not firing AtulSureka Outlook - Using Forms 1 February 6th 06 05:32 PM
SaveAs() sometimes loses userProperty! PuppetMaster Add-ins for Outlook 3 January 24th 06 11:49 AM
SaveAs() sometimes loses userProperty! PuppetMaster Outlook and VBA 3 January 24th 06 11:49 AM


All times are GMT +1. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.