|
Prev: SDIO problem in Windows Mobile 5.0 and 6.0
Next: converting to a double number in a diffrenet culture format
From: Magi on 3 Apr 2008 09:07 Hi all (and Peter specially:) ) I am able to create the signature of a custom account programmatically using the PR_CE_SIGNATURE and PR_CE_USE_SIGNATURE properties. So, during the installation of my .cab file in the setup process, I create the mail account and then I start the signature process. When ended, I can see the account and the signature properly set but if I create a new email I cannot see the signature in the mail!! But if I go in the mail option, I go in the page of the signature and without changing anything I press Done, after that I can see the signature in the mail :( Is there anything that I miss? Is there some sort of flush() or "StorePersistentlyAndUseIt"... I add my code... Thanks for help Marco wchar_t* setMailAccountSignature(const char* signature = NULL) { HRESULT hr; IMAPISession * pSession = NULL; IMAPITable* pTable = NULL; SRowSet* psrs = NULL; IMsgStore* pStore = NULL; BOOL accountFound = FALSE; SPropValue* rgprops = NULL; wchar_t* ret = NULL; bool msgset = false; // First log on to the store. hr = MAPILogonEx (NULL, NULL, NULL, NULL, &pSession); EXIT_ON_FAILED (hr); // Get the message stores table hr = pSession->GetMsgStoresTable (MAPI_UNICODE, &pTable); EXIT_ON_FAILED (hr); hr = pTable->SetColumns((LPSPropTagArray)&Columns, 0); EXIT_ON_FAILED(hr); while (!msgset){ // Get a row hr = pTable->QueryRows (1, 0, &psrs); EXIT_ON_FAILED (hr); // Did we hit the end of the table? if (psrs->cRows != 1) { break; } // // the display name is the name of the account. // wchar_t* displayName = psrs->aRow[0].lpProps[eePR_DISPLAY_NAME].Value.lpszW; // // The name of the MessageStore that we use for the own Transport // if (wcscmp(displayName, "MyAccount") == 0) { accountFound = TRUE; // Open this message store hr = pSession->OpenMsgStore (NULL, psrs->aRow[0].lpProps[0].Value.bin.cb, (ENTRYID *) psrs->aRow[0].lpProps[0].Value. bin.lpb, NULL, 0, &pStore); EXIT_ON_FAILED (hr); SPropValue rgprops[2] = {0}; rgprops[0].ulPropTag = PR_CE_SIGNATURE; rgprops[0].Value.lpszW = TEXT("my Signature"); rgprops[1].ulPropTag = PR_CE_USE_SIGNATURE; rgprops[1].Value.b = true; hr = pStore->SetProps(2, rgprops, NULL); EXIT_ON_FAILED (hr); } // Clean up MAPIFreeBuffer (rgprops); FreeProws (psrs); rgprops = NULL; psrs = NULL; RELEASE_OBJ (pStore); } if (accountFound == FALSE) { LOG.error("No " PROVIDER " account found"); } FuncExit: MAPIFreeBuffer (rgprops); FreeProws (psrs); RELEASE_OBJ (pStore); RELEASE_OBJ (pTable); RELEASE_OBJ (pSession); return ret; }
From: Peter Foot on 3 Apr 2008 09:26 Just a thought, but you could try closing the Messaging application when you run your installer and the launching it again at the end so it will pick up the new settings. Either send a WM_CLOSE to the main window or if that fails terminate the tmail.exe process. Peter -- Peter Foot Microsoft Device Application Development MVP www.peterfoot.net | www.inthehand.com In The Hand Ltd - .NET Solutions for Mobility "Magi" <magi(a)funambol.com> wrote in message news:elV8$uYlIHA.4480(a)TK2MSFTNGP03.phx.gbl... > Hi all (and Peter specially:) ) > I am able to create the signature of a custom account programmatically > using the PR_CE_SIGNATURE and PR_CE_USE_SIGNATURE properties. > So, during the installation of my .cab file in the setup process, I create > the mail account and then I start the signature process. When ended, I can > see the account and the signature properly set but if I create a new email > I cannot see the signature in the mail!! > But if I go in the mail option, I go in the page of the signature and > without changing anything I press Done, after that I can see the signature > in the mail :( > > Is there anything that I miss? Is there some sort of flush() or > "StorePersistentlyAndUseIt"... > I add my code... > Thanks for help > Marco > > > wchar_t* setMailAccountSignature(const char* signature = NULL) { > > HRESULT hr; > IMAPISession * pSession = NULL; > IMAPITable* pTable = NULL; > SRowSet* psrs = NULL; > IMsgStore* pStore = NULL; > BOOL accountFound = FALSE; > SPropValue* rgprops = NULL; > wchar_t* ret = NULL; > bool msgset = false; > > // First log on to the store. > hr = MAPILogonEx (NULL, NULL, NULL, NULL, &pSession); > EXIT_ON_FAILED (hr); > > // Get the message stores table > hr = pSession->GetMsgStoresTable (MAPI_UNICODE, &pTable); > EXIT_ON_FAILED (hr); > > hr = pTable->SetColumns((LPSPropTagArray)&Columns, 0); > EXIT_ON_FAILED(hr); > > > while (!msgset){ > // Get a row > hr = pTable->QueryRows (1, 0, &psrs); > EXIT_ON_FAILED (hr); > > // Did we hit the end of the table? > if (psrs->cRows != 1) { > break; > } > // > // the display name is the name of the account. > // > wchar_t* displayName = > psrs->aRow[0].lpProps[eePR_DISPLAY_NAME].Value.lpszW; > > // > // The name of the MessageStore that we use for the own Transport > // > if (wcscmp(displayName, "MyAccount") == 0) { > accountFound = TRUE; > > // Open this message store > hr = pSession->OpenMsgStore (NULL, > psrs->aRow[0].lpProps[0].Value.bin.cb, > (ENTRYID *) psrs->aRow[0].lpProps[0].Value. > bin.lpb, NULL, 0, &pStore); > EXIT_ON_FAILED (hr); > > SPropValue rgprops[2] = {0}; > > rgprops[0].ulPropTag = PR_CE_SIGNATURE; > rgprops[0].Value.lpszW = TEXT("my Signature"); > > rgprops[1].ulPropTag = PR_CE_USE_SIGNATURE; > rgprops[1].Value.b = true; > > hr = pStore->SetProps(2, rgprops, NULL); > EXIT_ON_FAILED (hr); > } > > // Clean up > MAPIFreeBuffer (rgprops); > FreeProws (psrs); > > rgprops = NULL; > psrs = NULL; > > RELEASE_OBJ (pStore); > } > if (accountFound == FALSE) { > LOG.error("No " PROVIDER " account found"); > } > FuncExit: > > MAPIFreeBuffer (rgprops); > FreeProws (psrs); > > RELEASE_OBJ (pStore); > RELEASE_OBJ (pTable); > RELEASE_OBJ (pSession); > > return ret; > }
From: Magi on 3 Apr 2008 12:33 Hi, thanks for the quick reply. I tried it but it doesn't work. I close the tmail.exe process usign also the Windows CE process viewer but nothing changes. I re-openend the mail several times but I cannot see the signature. Actually I'm quite lost... Marco Peter Foot ha scritto: > Just a thought, but you could try closing the Messaging application when > you run your installer and the launching it again at the end so it will > pick up the new settings. Either send a WM_CLOSE to the main window or > if that fails terminate the tmail.exe process. > > Peter >
From: Magi on 3 Apr 2008 12:33 Hi, thanks for the quick reply. I tried it but it doesn't work. I close the tmail.exe process usign also the Windows CE process viewer but nothing changes. I re-openend the mail several times but I cannot see the signature. Actually I'm quite lost... Marco Peter Foot ha scritto: > Just a thought, but you could try closing the Messaging application when > you run your installer and the launching it again at the end so it will > pick up the new settings. Either send a WM_CLOSE to the main window or > if that fails terminate the tmail.exe process. > > Peter >
From: Magi on 4 Apr 2008 04:12
Hi, I found the solution :) also the property PR_CE_USE_SIGNATURE_REPLY_FORWARD must be set. rgprops[0].ulPropTag = PR_CE_SIGNATURE; rgprops[0].Value.lpszW = (wchar_t*)sign.c_str(); rgprops[1].ulPropTag = PR_CE_USE_SIGNATURE; rgprops[1].Value.b = true; rgprops[2].ulPropTag = PR_CE_USE_SIGNATURE_REPLY_FORWARD; rgprops[2].Value.b = true; hr = pStore->SetProps(3, rgprops, NULL); Settings this one too, when I open the account for the first time and I write an email I can see the signature properly... Cheers and thanks Marco Magi ha scritto: > Hi, thanks for the quick reply. > I tried it but it doesn't work. I close the tmail.exe process usign also > the Windows CE process viewer but nothing changes. I re-openend the mail > several times but I cannot see the signature. > Actually I'm quite lost... > > Marco > > > Peter Foot ha scritto: >> Just a thought, but you could try closing the Messaging application >> when you run your installer and the launching it again at the end so >> it will pick up the new settings. Either send a WM_CLOSE to the main >> window or if that fails terminate the tmail.exe process. >> >> Peter >> |