Sunday, September 28, 2008

Adding a signature to a message account (setting properties on message accounts)

Hi!

For those of you with WIndows Mobile 6.1 devices, you might notice that your Activesync emails all automatically have signatures. We've gotten requests from partners wanting to do add/modify the signature to an account as well.  Here is a sample function to update the signature for the Activesync account.  Error checking removed in this sample code :).

#include <atlbase.h>
#include <cemapi.h>

HRESULT AddSignatureToAccount()
{
    HRESULT hr;

    CComPtr<IMAPITable> ptbl;
    CComPtr<IMAPISession> pSession;
    CComPtr<IMsgStore> pMsgStore;

    // Log onto MAPI
    hr = MAPILogonEx(0, NULL, NULL, 0, static_cast<LPMAPISESSION *>(&pSession));

    // You can open a different message store here instead of the default
    hr = pSession->OpenMsgStore(NULL, 0, NULL, NULL, 0, &pMsgStore);

    SPropValue rgspv[3] = { 0 };

    rgspv[0].ulPropTag      =   PR_CE_SIGNATURE;    // signature content
    rgspv[0].Value.lpszW    =   L"Sent from my personal Windows Mobile phone";
    
    rgspv[1].ulPropTag      =   PR_CE_USE_SIGNATURE;    // use the signature in newly composed emails
    rgspv[1].Value.b        =   TRUE;
    
    rgspv[2].ulPropTag      =   PR_CE_USE_SIGNATURE_REPLY_FORWARD;    // use signature in replied or forwarded emails
    rgspv[2].Value.b        =   TRUE;

    // save the data the properties
    hr = pMsgStore->SetProps (3, rgspv, NULL);
    
    // Log off
    pSession->Logoff(0, 0, 0);

    return hr;
}

This should be a good starting point on how to set properties on message accounts as well. You can find a list of valid properties in mapitags.h.  Have fun!

jayongg Sat, 27 Sep 2008 05:04:00 GMT


Source: http://blogs.msdn.com/windowsmobile/archive/2008/09/27/adding-a-signature-to-a-message-account-setting-properties-on-message-accounts.aspx
--
To unsubscribe from this feed, click here
To manage other subscriptions, click here
~
Powered by RssFwd, a service of Blue Sky Factory, Inc

Thursday, September 11, 2008

Trouble getting your ActiveSync provider to work with Windows Mobile Device Center?

As most of you know, ActiveSync has been replaced by a new app called Windows Mobile Device Center (WMDC) on Vista. I occasionally hear from developers who have problems getting their ActiveSync Sync Service Providers (SSPs) to work with WMDC. Usually its a registration issue and the error messages aren't very helpful.

I have a fix that I'd like to share with developers facing such problems. It's a very minor fix and has worked every single time I've suggested it to someone. Here's what you need to do: In the SSP's CLSID InprocServer32 regkey, add a string named "ThreadingModel" with the value "Apartment".

That's it. By doing this, in almost all cases your ActiveSync provider should work just fine with WMDC. Hope this little tip helps any developer struggling with WMDC issues.

-Mel

MelSam Tue, 09 Sep 2008 19:49:49 GMT


Source: http://blogs.msdn.com/windowsmobile/archive/2008/09/09/trouble-getting-your-activesync-provider-to-work-with-windows-mobile-device-center.aspx
--
To unsubscribe from this feed, click here
To manage other subscriptions, click here
~
Powered by RssFwd, a service of Blue Sky Factory, Inc