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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using a PropertyAccessor custom datetime property in Views



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 3rd 09, 10:36 AM posted to microsoft.public.outlook.program_addins
wclarke101
external usenet poster
 
Posts: 5
Default Using a PropertyAccessor custom datetime property in Views

Hello,

I'm having problems getting a datetime property (added using
PropertyAccessor) to display as a column in a customised View.

I've added the datetime property to the PropertyAccessor using the following
code...

objMailItem.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate", dtDocumentDate)

....where dtDocumentDate is a Date variable.

I've then tried to customise the folder's View to show this custom property
as a column. This is the XML excerpt...

column
typedatetime/type
headingDocumentDate/heading
prophttp://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate/prop
width200/width
stylepadding-left:3px;;text-align:left/style
editable1/editable
formatM/d/yyyy||h:mm tt/format
displayformat2/displayformat
/column

.... but the when I run the application, the this DocumentDate column just
displays the word "None".

If i changed the XML to use a string column instead of a datetime column,
then it displays the date, but the column sorting doesn't work properly
because Outlook is treating the values as strings.

How do i reference a custom datetime property in the View XML? Any help
would be greatly appreciated.

I'm using VSTO with Outlook 2007.

Thanks,
Wayne.
Ads
  #2  
Old September 3rd 09, 02:47 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using a PropertyAccessor custom datetime property in Views

http://schemas.microsoft.com/mapi/string. You are creating a PT_STRING8
property, not a PT_SYSTIME property, why would you expect it to correctly
display in the grid as a date/time column?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"wclarke101" wrote in message
...
Hello,

I'm having problems getting a datetime property (added using
PropertyAccessor) to display as a column in a customised View.

I've added the datetime property to the PropertyAccessor using the
following
code...

objMailItem.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate",
dtDocumentDate)

...where dtDocumentDate is a Date variable.

I've then tried to customise the folder's View to show this custom
property
as a column. This is the XML excerpt...

column
typedatetime/type
headingDocumentDate/heading
prophttp://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate/prop
width200/width
stylepadding-left:3px;;text-align:left/style
editable1/editable
formatM/d/yyyy||h:mm tt/format
displayformat2/displayformat
/column

... but the when I run the application, the this DocumentDate column just
displays the word "None".

If i changed the XML to use a string column instead of a datetime column,
then it displays the date, but the column sorting doesn't work properly
because Outlook is treating the values as strings.

How do i reference a custom datetime property in the View XML? Any help
would be greatly appreciated.

I'm using VSTO with Outlook 2007.

Thanks,
Wayne.


  #3  
Old September 3rd 09, 03:11 PM posted to microsoft.public.outlook.program_addins
wclarke101
external usenet poster
 
Posts: 5
Default Using a PropertyAccessor custom datetime property in Views

Thanks Ken.

How do I add a PT_SYSTIME custom property to PropertyAccessor that would
then display as a date/time column in the grid?

Do you have sample code for the SetProperty method call and the XML column
tag I would need?

Thanks,
Wayne.



"Ken Slovak - [MVP - Outlook]" wrote:

http://schemas.microsoft.com/mapi/string. You are creating a PT_STRING8
property, not a PT_SYSTIME property, why would you expect it to correctly
display in the grid as a date/time column?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"wclarke101" wrote in message
...
Hello,

I'm having problems getting a datetime property (added using
PropertyAccessor) to display as a column in a customised View.

I've added the datetime property to the PropertyAccessor using the
following
code...

objMailItem.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate",
dtDocumentDate)

...where dtDocumentDate is a Date variable.

I've then tried to customise the folder's View to show this custom
property
as a column. This is the XML excerpt...

column
typedatetime/type
headingDocumentDate/heading
prophttp://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate/prop
width200/width
stylepadding-left:3px;;text-align:left/style
editable1/editable
formatM/d/yyyy||h:mm tt/format
displayformat2/displayformat
/column

... but the when I run the application, the this DocumentDate column just
displays the word "None".

If i changed the XML to use a string column instead of a datetime column,
then it displays the date, but the column sorting doesn't work properly
because Outlook is treating the values as strings.

How do i reference a custom datetime property in the View XML? Any help
would be greatly appreciated.

I'm using VSTO with Outlook 2007.

Thanks,
Wayne.



  #4  
Old September 3rd 09, 03:41 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using a PropertyAccessor custom datetime property in Views

Why not just use the UserProperties collection?

The http://schemas.microsoft.com/mapi/id/ PropertyAccessor namespace does
take a GUID, but it also requires a property tag. You couldn't refer to the
property by name, since it wouldn't have a name but a property tag.
Unfortunately there is no GetIDsFromNames() method in the object model that
would allow using a name and deriving a MAPI property tag from it.

You would use something like this, given that a PT_SYSTIME has the property
tag OR'd with 0x0040. This example uses an id value picked at random,
0x8502:

Const Custom_Tag =
"http://schemas.microsoft.com/mapi/id/{FFF40745-D92F-4C11-9E14-92701F001EB3}/85020040"

Note that the const should be all on one line as a continuous string. The
GUID is the same as your custom namespace GUID and the id part is composed
of the 0x8502 value I selected at random and the 0x0040 value for a
PT_SYSTIME.

You would use that const with your call to PropertyAccessor.SetProperty()
and in your view XML. That should be the only change needed in the view XML.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"wclarke101" wrote in message
...
Thanks Ken.

How do I add a PT_SYSTIME custom property to PropertyAccessor that would
then display as a date/time column in the grid?

Do you have sample code for the SetProperty method call and the XML column
tag I would need?

Thanks,
Wayne.


 




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
Cannot read Property set in MeetingRequest via PropertyAccessor Upul Samaranayake Outlook and VBA 3 March 12th 09 10:03 PM
Accessing another custom form and the associated custom property melon Outlook - Using Forms 1 December 1st 08 02:41 PM
FileAs Custom Property Cass Outlook - Using Forms 8 September 24th 07 01:45 PM
DASL Filter on custom property Jeff Graves Add-ins for Outlook 0 April 8th 07 04:58 AM
How to validate a Custom Property Page Jack Zhang Add-ins for Outlook 1 February 9th 06 07:22 PM


All times are GMT +1. The time now is 09:32 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.