POOM Notifications (Peter?)

C

Code Blue

Hi,

I can't believe that no (public) code exists that WORKS and clearly shows
how to get POOM notification events to your app.

I tried the MSDN example for getting PIM_ITEM_REMOTE_CREATED but my app
never gets notified.
the Logon(hWnd) function returns S_OK, and so does the subscription
function. Is there anything extra that needs to be done???

Here's the code provided by MSDN which I'm using:

(WndProc Message handling not shown, I'm just showing a messagebox when the
message is received, which never happens)

Thanks,

Alex


void OutlookNotifications()
{
HRESULT hr = E_FAIL;

// Initialize COM for using the Pocket Outlook Object Model (POOM).
CoInitializeEx(NULL, 0);

// Get a reference to the POOM (Outlook Mobile) application object.
hr = CoCreateInstance(CLSID_Application,
NULL,
CLSCTX_INPROC_SERVER,
IID_IPOutlookApp2,
(LPVOID*)&pPoom);


// Logon to the POOM session.
hr = pPoom->Logon((long)hWnd);

// Subscribe to local and remote appointment notifications.
hr = SubscribeToNotifications(pPoom, olFolderCalendar,
PIMFOLDERNOTIFICATION_ALL);

// Insert your code for creating a dialog window, here.
return;
}

// Function to subscribe to notifications based on folder type.

HRESULT SubscribeToNotifications(IPOutlookApp2 *pPoom, OlDefaultFolders
olFolder, uint uiNotificationsType)
{
HRESULT hr = 0;
IFolder *pFolder = NULL;
IItem *pItem = NULL;
CEPROPVAL propval = {0};

// Get the folder for the item type.
hr = pPoom->GetDefaultFolder(olFolder, &pFolder);

// Get the IItem interface for the IFolder.
hr = pFolder->QueryInterface(IID_IItem, (LPVOID*)&pItem);

// Set the folder's properties.
propval.propid = PIMPR_FOLDERNOTIFICATIONS;
propval.val.ulVal = uiNotificationsType;
hr = pItem->SetProps(0, 1, &propval);

pItem->Release();
pFolder->Release();
return hr;
}
 
G

Guest

I've used the sample in MSDN and it worked for external and internal
notifications. If you still have no luck, I'll take a look when I get to my
office tomorrow for some code.

-Chris
 

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