Setting custom properties to an outlook folder

M

Michael Jennings

Hi,
I'm new to the Outlook 2007 object model. I want to create and set some
custom properties to my outlook folders. eg I want to set a property like
'SOURCE URL', which is of string type, that will enable me to find out
programmatically which folder belongs to which url. I think PropertyAccessor
has something to do with it. But I don't know how to use it. In what format
the property name should be given?
It throws an exception that 'Unable to parse the property name'.
 
S

Sue Mosher [MVP-Outlook]

Please post the relevant portion of the code you already have in the microsoft.public.outlook.program_vba newsgroup, which handles programming issues.

For custom properties, Microsoft recommends using the MAPI string namespace, which uses this syntax for the property name, which is always a string:

"http://schemas.microsoft.com/mapi/string/{HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH}/name"

where {HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH} is a GUID (globally unique ID) and name is the property name itself. Developers of Outlook add-ins should use the GUID for their application as the GUID for the property.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Michael Jennings

I've set my property name as:-
"http://schemas.microsoft.com/mapi/string/{5ae18700-583b-4e33-b0b8-bbcffc9ebd24}/siteUrl"

It throws an exception :-

The property
"http://schemas.microsoft.com/mapi/string/{5ae18700-583b-4e33-b0b8-bbcffc9ebd24}/siteUrl" does not support this operation.

when I invoke SetProperty(). This is my code below:-

string prop =
"http://schemas.microsoft.com/mapi/string/{5ae18700-583b-4e33-b0b8-bbcffc9ebd24}/siteUrl";
Folder folder = (Folder)tasksFolder.Folders.Add(folderName,
OlDefaultFolders.olFolderTasks);
folder.PropertyAccessor.SetProperty(prop, "http://www.microsoft.com");

-Thanks
 
S

Sue Mosher [MVP-Outlook]

Ah, I forgot that you can't create custom properties on a folder, only read MAPI properties with PropertyAccessor. Instead, create a new StorageItem in a mail/post folder and use that to hold your application information.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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