Hi,
Found some of these parameters from
"http://groups.google.co.in/group/microsoft.public.exchange.clients/browse_frm/th
read/3a2838c1ccda472/b261c3be8742b78a?lnk=st&q=PR_LAST_ACCESS_TIME&rnum=1&hl=en#
b261c3be8742b78a"
link. But when I tried to extract these properties on public folder
object, I got proper return values for
1. PR_DISPLAY_NAME
2. PR_MESSAGE_SIZE
3. PR_CONTENT_COUNT
4. PR_CONTENT_UNREAD
5. PR_REPLICATION_STYLE
5. PR_FOLDER_PATHNAME
but for other properties for the first public folder itself my code
will exit from the loop. This is not going further. Not sure why this
is so?
Other properties which I am interested are :
6. PR_INSTANCE_KEY
7. PR_EMAIL_ADDRESS
8. PR_LAST_ACCESS_TIME
Here with I have give my sample code which is not working while getting
6-8 properties.
----------------------------- connection to PUBLIC FOLDERS
------------------------------
//Initialize MAPI libraries
hr_p = MAPIInitialize (NULL);
hr_p = MAPILogonEx (NULL, "", NULL, MAPI_EXTENDED| MAPI_NEW_SESSION|
MAPI_LOGON_UI| MAPI_EXPLICIT_PROFILE,&pSession);
hr_p = HrOpenExchangePublicStore(pSession, &pmdbPublicACL);
hr_p = HrOpenExchangePublicFolders (pmdbPublicACL, &pRoot);
hr_dir = MAPICALL( pRoot)->GetHierarchyTable( MAPI_DEFERRED_ERRORS,
&lpTable);
hr_dir = HrQueryAllRows( lpTable, (LPSPropTagArray)&rgColProps, NULL,
NULL, 0L, &lpRow);
for(j = 0; j < lpRow->cRows; j++)
{
hr_p = HrMAPIFindSubfolderEx (pRoot, PATH_SEP,
(LPCSTR)l_strFullPath, &cbeid, &lpeid);
hr_p = pmdbPublicACL->OpenEntry ( cbeid, lpeid, NULL, MAPI_MODIFY,
&ulObjType,(LPUNKNOWN*)&pFolder );
-------------- in this folder trying to get 6-8 properties on pFolder
--------------------------------------------------------------------------------------
//to get PR_INSTANCE_KEY
LPSPropValue ppvKEY;
HrGetOneProp(
pFolder,
PR_INSTANCE_KEY,
&ppvKEY);
printf(" key = %d\n",ppvKEY->Value.l);
---------------------------------------------------------------------------------------------------
// to get PR_EMAIL_ADDRESS
LPSPropValue ppvEMAIL;
HrGetOneProp(
pFolder,
PR_EMAIL_ADDRESS,
&ppvEMAIL);
printf("Email Address: %s\n", lpspv->Value.lpszA);
----------------------------------------------------------------------------------------------------
// to get PR_LAST_ACCESS_TIME
SYSTEMTIME sLogonSystemTime = {0};
SYSTEMTIME sLogonLocalTime = {0};
SYSTEMTIME sLogoffSystemTime = {0};
SYSTEMTIME sLogoffLocalTime = {0};
BOOL fSucceeded = FALSE;
LPSPropValue ppvCRTIME;
HrGetOneProp(
pFolder,
PR_LAST_ACCESS_TIME,
&ppvCRTIME);
fSucceeded = FileTimeToSystemTime(&(ppvCRTIME->Value.ft),
&sLogonSystemTime);
if (fSucceeded)
{
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
SystemTimeToTzSpecificLocalTime(&tzi, &sLogonSystemTime,
&sLogonLocalTime);
printf("PR_LAST_LOGON_TIME month: %2.2d/",
sLogonLocalTime.wMonth);
}
-----------------------------------------------------------------------------------------------------------------------
For me it seems perfect as I was able to retrieve 1-5 properties in the
same way. But not sure what is wrong while getting 6-8 properties.
Could any one please help me to get this done?
Regards,
John
> Hi,
>
[quoted text clipped - 10 lines]
> Cheers,
> John
Dan Mitchell - 24 Nov 2006 16:38 GMT
> 6. PR_INSTANCE_KEY
> 7. PR_EMAIL_ADDRESS
> 8. PR_LAST_ACCESS_TIME
What error are you getting when trying to read those properties? If you
look at the folder with mfcmapi / mdbview, are those properties actually
there?
If I look at a public folder here, none of those properties exist on it,
so I wouldn't expect code to be able to read them..
-- dan
john - 27 Nov 2006 07:18 GMT
Hi Dan,
You are right. I installed MAPI_Editor and confirmed that these
properties does not exist at all for public folder. Instead of these I
found some other properties like PR_LAST_MODIFICATION_TIME and
PR_CREATION_TIME which were needed for my work. But when I tried
accessing these values I am getting DAY-MONTH-YEAR values properly but
not HOUR-MINUTE values.
Attached is the screenshot of MAPI_Editor screen showing
PR_LAST_MODIFICATION_TIME for "public_folder_2" which shows "06:30:57
AM 11/20/2006" but my code output shows "PR_LAST_MODIFICATION_TIME is :
12:00 11/20/2006" below is the code which is used to get this value.
-------------------------------------------------------------------
SYSTEMTIME sLogonSystemTime = {0};
SYSTEMTIME sLogonLocalTime = {0};
LPSPropValue ppvLASTMODTIME;
HrGetOneProp(
pFolder,
PR_LAST_MODIFICATION_TIME,
&ppvLASTMODTIME
);
fSucceeded = FileTimeToSystemTime(&(ppvLASTMODTIME->Value.ft),
&sLogonSystemTime);
if (fSucceeded)
{
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
SystemTimeToTzSpecificLocalTime(&tzi, &sLogonSystemTime,
&sLogonLocalTime);
printf("\nPR_LAST_MODIFICATION_TIME is : %2.2d:%2.2d
%2.2d/%2.2d/%2.2d",sLogonLocalTime.wHour,sLogonLocalTime.wMinute,sLogonLocalTime.wMonth,sLogonLocalTime.wDay,sLogonLocalTime.wYear);
}
-------------------------------------------------------------------
any idea why this is so? And the same problem exists for
PR_CREATION_TIME also.. and this is in case of all public folders!!!
Please let me know if you have any idea on this.
Regards,
Shivaraj
> > 6. PR_INSTANCE_KEY
> > 7. PR_EMAIL_ADDRESS
[quoted text clipped - 8 lines]
>
> -- dan
Dan Mitchell - 27 Nov 2006 17:20 GMT
> Attached is the screenshot of MAPI_Editor screen showing
> PR_LAST_MODIFICATION_TIME for "public_folder_2" which shows "06:30:57
> AM 11/20/2006" but my code output shows "PR_LAST_MODIFICATION_TIME is
> : 12:00 11/20/2006" below is the code which is used to get this value.
Take a look at the source to mfcmapi / mdbview, there's a lot of example
code in there to read properties.
I'd suggest checking your time conversion code, though, if you're just
losing detail below the day, that seems most likely to be the problem. It
looks reasonable, but I may be missing something. Is the intermediate
SYSTEMTIME valid?
What happens if you try and read these properties from regular folders,
or from a message?
-- dan