Using a PropertyAccessor custom datetime property in Views

Status
Not open for further replies.
W

wclarke101

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
<type>datetime</type
<heading>DocumentDate</heading
<prop>http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate</prop
<width>200</width
<style>padding-left:3px;;text-align:left</style
<editable>1</editable
<format>M/d/yyyy||h:mm tt</format
<displayformat>2</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.
 
K

Ken Slovak - [MVP - Outlook]

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?

"wclarke101" <wclarke101> wrote in message

news:0F285D68-DF35-4AC8-98BC-3F2E736F83D5@microsoft.com...
> 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
> <type>datetime</type
> <heading>DocumentDate</heading
> <prop>http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate</prop
> <width>200</width
> <style>padding-left:3px;;text-align:left</style
> <editable>1</editable
> <format>M/d/yyyy||h:mm tt</format
> <displayformat>2</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.
 
W

wclarke101

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

> >

>

> "wclarke101" <wclarke101> wrote in message
> news:0F285D68-DF35-4AC8-98BC-3F2E736F83D5@microsoft.com...
> > 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
> > <type>datetime</type
> > <heading>DocumentDate</heading
> > <prop>http://schemas.microsoft.com/mapi/string/{FFF40745-D92F-4C11-9E14-92701F001EB3}/DocumentDate</prop
> > <width>200</width
> > <style>padding-left:3px;;text-align:left</style
> > <editable>1</editable
> > <format>M/d/yyyy||h:mm tt</format
> > <displayformat>2</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.


>
 
K

Ken Slovak - [MVP - Outlook]

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.

"wclarke101" <wclarke101> wrote in message

news:41BCB1C5-462E-48EF-9070-F2E9619DD24C@microsoft.com...
> 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.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
Z Import Tasks from Access Using VBA including User Defined Fields Outlook VBA and Custom Forms 0
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 8
M Extract "Date sent" from emails (saved to folder using drag and drop) Outlook VBA and Custom Forms 1
I Outlook for Mac 2019 using on desktop and laptop IMAP on both need help with folders Using Outlook 1
David McKay VBA to manually forward using odd options Outlook VBA and Custom Forms 1
H Stationery using between OL 2019 and OL 2010 Using Outlook 0
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
O Calendar - Location: what happens when using my own way of entering locations Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
S Outlook VBA How to adapt this code for using in a different Mail Inbox Outlook VBA and Custom Forms 0
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
X Using Outlook 2013 and Outlook 365 Using Outlook 1
A Going to folder using shortcuts Using Outlook 3
A Outlook replies not using "delivered to" address in From Using Outlook 1
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 4
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
K Using Outlook 2016 to draw Using Outlook 1
O Outlook 365 - suddenly unable to send using Gmail POP3 Using Outlook 10
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Office 365 using POP3 on both laptop and desktop Using Outlook 0
M Using field names to capture a data element Using Outlook 0
B Vba to monitor time to respond to emails using a shared mailbox Outlook VBA and Custom Forms 5
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
O Using .OST and .PST mail thru different providers Using Outlook 5
N Open & Save VBAProject.Otm using VBA Code Outlook VBA and Custom Forms 1
D Remove text in subject using VBA Outlook VBA and Custom Forms 4
P How to export voting results using VBA? Outlook VBA and Custom Forms 2
E Using the Like operator properly Outlook VBA and Custom Forms 1
R Using "check for duplicates" for existing contacts Using Outlook 2
S Find a cell value in excel using outlook vba Using Outlook 1
N Using email notification to update calendar events? Outlook VBA and Custom Forms 4
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
C Sync Calendars using WiFI Using Outlook 3
A Capturing Send Variables without using Application_ItemSend in ThisOutlookSession Outlook VBA and Custom Forms 8
L Using alpha numeric in email address Using Outlook 5
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
D Print Attachments only in selected emails using a macro Outlook VBA and Custom Forms 3

Similar threads

Top