Setting a MAPI property of type PT_SYSTIME

T

Tobias Böhm

Hello,

I'm trying to set the MAPI property PR_MESSAGE_DELIVERY_TIME of a
PostItem because I can't manage to set the "Received Date" on the
Outlook-Object. So I create the PostItem item, get a MapiItem from
that, close the initial PostItem (I heard it would reset any dates
when the item is still open) and set the property.

But I can't manage to set a proper date. The line looks like that:
mapiItem.SetProperty(0x0E060040, dateTimeValue);

I tried passing the DateTime object, a date/time string in various
formats but every time some date gets set that's either way in the
future (01.01.3702) or way in the past (01.01.1601).

Any hints on how to set the date properly?

Thanks,
Tobias

(I posted the same question on the board of the add-in framework I use
http://www.add-in-express.com/forum/read.php?FID=5&TID=5919 but I
think it might be more suitable here)
 
K

Ken Slovak - [MVP - Outlook]

I'd first ask some of the same questions that you were asked on the Add-In
Express forum that were never answered.

What version of Outlook and what is mapiItem? Is it an Outlook 2007
PropertyAccessor, an Extended MAPI object, a Redemption object or what?

If this was a Redemption RDOMail object (or the RDOPost item derived from
RDOMail) I have no problem changing PR_MESSAGE_DELIVERY_TIME like this (VBA
code):

oMail.Fields(PR_MESSAGE_DELIVERY_TIME) = CDate("8/17/2009 11:00 AM")
 
T

Tom

Hi Tobias,

This is how I set the time using extended mapi

Outlook::_NameSpacePtr spNameSpace = sp->GetSession();
IUnknownPtr pUnk = sp->GetMAPIOBJECT();
CComQIPtr<IMessage, &IID_IMessage> spMessage(pUnk);
long lUTC = 0L;
time(&lUTC);

SPropValue prop;
UnixTimeToFileTime(lUTC, &(prop.Value.ft));

prop.ulPropTag = PR_MESSAGE_DELIVERY_TIME;
hr = HrSetOneProp((LPMAPIPROP)(IUnknown*)spMessage, &prop );

Regards,
Tom
 
T

Tobias Böhm

I'd first ask some of the same questions that you were asked on the Add-In
Express forum that were never answered.

What version of Outlook and what is mapiItem? Is it an Outlook 2007
PropertyAccessor, an Extended MAPI object, a Redemption object or what?

If this was a Redemption RDOMail object (or the RDOPost item derived from
RDOMail) I have no problem changing PR_MESSAGE_DELIVERY_TIME like this (VBA
code):

oMail.Fields(PR_MESSAGE_DELIVERY_TIME) = CDate("8/17/2009 11:00 AM")

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


I'm trying to set the MAPI property PR_MESSAGE_DELIVERY_TIME of a
PostItem because I can't manage to set the "Received Date" on the
Outlook-Object. So I create the PostItem item, get a MapiItem from
that, close the initial PostItem (I heard it would reset any dates
when the item is still open) and set the property.
But I can't manage to set a proper date. The line looks like that:
mapiItem.SetProperty(0x0E060040, dateTimeValue);
I tried passing the DateTime object, a date/time string in various
formats but every time some date gets set that's either way in the
future (01.01.3702) or way in the past (01.01.1601).
Any hints on how to set the date properly?

(I posted the same question on the board of the add-in framework I use
http://www.add-in-express.com/forum/read.php?FID=5&TID=5919but I
think it might be more suitable here)


Well, sorry, both your messages are new to me.
It is Outlook 2003 & 2007 and I'm using Extended MAPI.
 
K

Ken Slovak - [MVP - Outlook]

If you're using Extended MAPI then see Tom's answer, that should work.




<snip>
Well, sorry, both your messages are new to me.
It is Outlook 2003 & 2007 and I'm using Extended MAPI.
 

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