Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / November 2006

Tip: Looking for answers? Try searching our database.

How to get Exchange Specific MAPI properties?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john - 24 Nov 2006 06:12 GMT
Hi,

Question seems to be very silly but need help as not getting how to!!!
I am trying to get Exchange Server PUBLIC FOLDER information using
MAPI in C++. I got some fields like PR_DISPLAY_NAME, PR_MESSAGE_SIZE
for each public folders. But how to know what all information about
public folders can be retrieved using MAPI porperties?
"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/af87a
a9c-02f9-4b2c-9c7b-0fa1ea27af02.asp
"
like is giving all general MAPI properties for an object. How to check
which properties ( PR_XXX ) amongst these are related to exchange
public folder?

Cheers,
John
john - 24 Nov 2006 09:03 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.