NO

Author Topic: Pocket Outlook / POOM/ pimstore  (Read 2676 times)

ajige

  • Guest
Pocket Outlook / POOM/ pimstore
« on: February 24, 2009, 01:16:38 am »
Has anyone been able to compile an application with PellesC to get information from Pocket Outlook' tasks and appointments?
I have tried various samples from the web, but without any success. One problem is, I can't find the file pimstore.lib which might be essential. Is there any other way to access Pocket outlook items?
Any help would be greatly appreciated.

ajige

  • Guest
Re: Pocket Outlook / POOM/ pimstore
« Reply #1 on: February 25, 2009, 06:16:47 pm »
Never mind - I finally figured it out. If anyone  else needs it:
1) Used the following headers:
   
Code: [Select]
#include <objbase.h>
#define INITGUID
#include <initguid.h>
#include <windows.h>
#include "pimstore.h"
2) Added ole32.lib to the Project linker page
3) Rewrote the functions as per the pimstore.h file for c code (as most info on the web is c++ code)

The following code will show tasks:
Code: [Select]
IFolder  *pFolder=NULL;
IPOutlookItemCollection *pTasks;
int olFolderTasks =13;
IPOlItems *pItem;
ITask *pTask;
//Initialize COM for Pocket Outlook
if (FAILED(CoInitializeEx(NULL, 0))) return FALSE;
// Get the application object
IPOutlookApp *polApp;
HRESULT hr;
BSTR bstrVersion;
hr = CoCreateInstance(&CLSID_Application, NULL, CLSCTX_INPROC_SERVER, &IID_IPOutlookApp, (LPVOID *)&polApp);
if (FAILED(hr)) return FALSE;

polApp->lpVtbl->Logon(polApp,0);
polApp->lpVtbl->GetDefaultFolder(polApp,olFolderTasks, &pFolder);
pFolder->lpVtbl->get_Items(pFolder,&pTasks);
 pTasks->lpVtbl->QueryInterface(pTasks,&IID_IPOlItems, (LPVOID *) &pItem);
int numItems,i;
pItem->lpVtbl->get_Count(pItem,&numItems);
for (i = 1; i <=numItems; i++)
{
pItem->lpVtbl->Item(pItem,i, (IDispatch **) &pTask);
LPTSTR Fname;
  pTask->lpVtbl->get_Subject(pTask,&Fname);
MessageBox(hwndDlg,Fname,TEXT("Task subject"),MB_OK);
}

hr = polApp->lpVtbl->get_Version(polApp,&bstrVersion);
MessageBox (hwndDlg,bstrVersion,TEXT("POOM version"),MB_OK );

polApp->lpVtbl->Logoff(polApp);
polApp->lpVtbl->Release(polApp);

I just hope I'm using the lpVtbl part correctly, since I don't really have a clue what's going on with that.

But the code is working. :)