 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lurkio Guest
|
Posted: Fri Jun 17, 2005 3:22 pm Post subject: Retrieving Outlook Task StartDate property via HrGetOneProp |
|
|
Hello,
I've been using Extended MAPI to get properties from
Outlook tasks and this has been working fine...
However, I have been having problems trying to retrieve
the StartDate and EndDate properties of a task using
the same code that worked so successfully for the other
properties. The HrGetOneProp call in the following code
snippet fails. I used OutlookSpy to get the IDs for for
these properties the same way as I did for the other
properties that worked such as Status and PercentComplete.
const
TaskItem_GUID : TGUID = '{00062003-0000-0000-C000-000000000046}';
procedure ViewTaskStartDate(const AMsg : IMessage);
var
namProp:array[0..0] of TMAPINAMEID;
Names:array[0..0] of PMAPINAMEID;
namTag : PSPropTagArray;
PR_PROPERTY : ULONG;
assContProp : PSPropValue;
begin
with namProp[0] do
begin
lpguid := @TaskItem_GUID;
ulKind := MNID_ID;
Kind.lID := $8104; // StartDate property ID
end;
Names[0] := @namProp[0];
if S_OK = AMsg.GetIDsFromNames(1, Names[0], MAPI_CREATE, namTag) then
try
PR_PROPERTY := PT_SYSTIME or namTag^.aulPropTag[0];
if S_OK = HrGetOneProp(AMsg, PR_PROPERTY, assContProp) then
begin
try
// We've got the property...
// <do stuff with it>
finally
MAPIFreeBuffer(assContProp);
end;
end
else
// This is what happens...
MessageDlg('HrGetOneProp failed.', mtError, [mbOK], 0);
finally
MAPIFreeBuffer(namTag);
end
end;
Does anyone have any ideas ?
Thanks in advance,
Lurkio
|
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Tue Jun 21, 2005 12:01 am Post subject: Re: Retrieving Outlook Task StartDate property via HrGetOneP |
|
|
Looks perfectly fine to me. What is the error? Is the property tag the same
as shown by OutlookSpy? Are you sure that particular task has the Start
propetty? Unless you explicitly set it in the UI, tasks do not have start
dates.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Lurkio" <spam?@no.thanks> wrote
| Quote: | Hello,
I've been using Extended MAPI to get properties from
Outlook tasks and this has been working fine...
However, I have been having problems trying to retrieve
the StartDate and EndDate properties of a task using
the same code that worked so successfully for the other
properties. The HrGetOneProp call in the following code
snippet fails. I used OutlookSpy to get the IDs for for
these properties the same way as I did for the other
properties that worked such as Status and PercentComplete.
const
TaskItem_GUID : TGUID = '{00062003-0000-0000-C000-000000000046}';
procedure ViewTaskStartDate(const AMsg : IMessage);
var
namProp:array[0..0] of TMAPINAMEID;
Names:array[0..0] of PMAPINAMEID;
namTag : PSPropTagArray;
PR_PROPERTY : ULONG;
assContProp : PSPropValue;
begin
with namProp[0] do
begin
lpguid := @TaskItem_GUID;
ulKind := MNID_ID;
Kind.lID := $8104; // StartDate property ID
end;
Names[0] := @namProp[0];
if S_OK = AMsg.GetIDsFromNames(1, Names[0], MAPI_CREATE, namTag) then
try
PR_PROPERTY := PT_SYSTIME or namTag^.aulPropTag[0];
if S_OK = HrGetOneProp(AMsg, PR_PROPERTY, assContProp) then
begin
try
// We've got the property... //
finally
MAPIFreeBuffer(assContProp);
end; end
else
// This is what happens...
MessageDlg('HrGetOneProp failed.', mtError, [mbOK], 0);
finally
MAPIFreeBuffer(namTag);
end
end;
Does anyone have any ideas ?
Thanks in advance,
Lurkio
|
|
|
| Back to top |
|
 |
Lurkio Guest
|
Posted: Tue Jun 21, 2005 9:28 am Post subject: Re: Retrieving Outlook Task StartDate property via HrGetOneP |
|
|
Dmitry Streblechenko wrote:
| Quote: | Looks perfectly fine to me. What is the error? Is the property tag the same
as shown by OutlookSpy? Are you sure that particular task has the Start
property? Unless you explicitly set it in the UI, tasks do not have start
dates.
|
Thanks Dmitry, you were right. The task not having the StartDate property set
in the UI was the problem. The code now works as expected.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|