Jump to content

Recommended Posts

Guest dheeraj
Posted

Hi All!

I would like ot know hoe to read the SMS within the inbox of the smartphone. I would like some guidelines as to how to read the messages (SMS) already residing in the Inbox of the smartphone. I have tried reading some code with MAPI but hardly got any success, any help will be highly appreciated. Thx...

Posted

MAPI is enough.

MAPILogonEx->GetMsgStoresTable->QueryRows->OpenMsgStore->GetReceiveFolder->GetContentsTable->QueryRows

Guest dheeraj
Posted

hey there!

thx...following is the code i've written but don't know hoe to proceed further...kindly help...

HRESULT hr;

LPVOID lpMapiInit = NULL;

IMAPISession * pSession = NULL;

IMAPITable * pTable = NULL;

SRowSet * psrs = NULL;

IMsgStore * pStore = NULL;

ULONG rgTags[] = { 1, PR_CE_IPM_INBOX_ENTRYID };

ULONG rgMsgTags[] = { 1, PR_ENTRYID };

ULONG cValues = 0;

SPropValue * rgprops = NULL;

SPropValue * rgpropsMsg = NULL;

LPMAPIFOLDER pfldrDrafts = NULL;

IMessage * pmsg = NULL;

if(FAILED(MAPIInitialize(lpMapiInit)))

{

MessageBox(NULL, TEXT("failed"), TEXT("failed"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success"), TEXT("success"), MB_SETFOREGROUND | MB_OK);

}

if(FAILED(MAPILogonEx (NULL, NULL, NULL, NULL, &pSession)))

{

MessageBox(NULL, TEXT("failed1"), TEXT("failed1"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success1"), TEXT("success1"), MB_SETFOREGROUND | MB_OK);

}

if(FAILED(pSession->GetMsgStoresTable (MAPI_UNICODE, &pTable)))

{

MessageBox(NULL, TEXT("failed2"), TEXT("failed2"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success2"), TEXT("success2"), MB_SETFOREGROUND | MB_OK);

}

if(FAILED(pTable->QueryRows (1, 0, &psrs)))

{

MessageBox(NULL, TEXT("failed3"), TEXT("failed3"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success3"), TEXT("success3"), MB_SETFOREGROUND | MB_OK);

}

// Did we hit the end of the table?

if (psrs->cRows != 1)

{

return 0;

}

if ((psrs->aRow[0].cValues < 1) || (psrs->aRow[0].lpProps[0].ulPropTag != PR_ENTRYID))

{

MessageBox (NULL, L"Store missing PR_ENTRYID!", L"Doh", MB_OK);

hr = E_FAIL;

return 0;

}

// Open this message store

if(FAILED(pSession->OpenMsgStore (NULL,

psrs->aRow[0].lpProps[0].Value.bin.cb,

(ENTRYID *) psrs->aRow[0].lpProps[0].Value.

bin.lpb, NULL, 0, &pStore)))

{

MessageBox(NULL, TEXT("failed4"), TEXT("failed4"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success4"), TEXT("success4"), MB_SETFOREGROUND | MB_OK);

}

if(FAILED(pStore->GetProps ((SPropTagArray *) rgTags, MAPI_UNICODE, &cValues, &rgprops)))

{

MessageBox(NULL, TEXT("failed5"), TEXT("failed5"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success5"), TEXT("success5"), MB_SETFOREGROUND | MB_OK);

}

//hr = pStore->GetProps ((SPropTagArray *) rgTags, MAPI_UNICODE, &cValues, &rgprops);

ASSERT (rgprops);

ASSERT (rgprops[0].ulPropTag == PR_CE_IPM_INBOX_ENTRYID);

if(FAILED(pStore->OpenEntry (rgprops[0].Value.bin.cb,

(LPENTRYID)rgprops[0].Value.bin.lpb,

NULL,

MAPI_MODIFY,

NULL,

(IUnknown **) &pfldrDrafts)))

{

MessageBox(NULL, TEXT("failed6"), TEXT("failed6"), MB_SETFOREGROUND | MB_OK);

}

else

{

MessageBox(NULL, TEXT("success6"), TEXT("success6"), MB_SETFOREGROUND | MB_OK);

}

ASSERT (pfldrDrafts);

//// ********* end ****************

// pfldrDrafts points to inbox..

well after this i need help on how to have entry point to messages inside folder and then extract data like, sms/sender's name, date-time

any help will be highly appreciated..thx

Posted

You can use GetContentsTable to get rows of message properties , including entryid.Use this entry id to query the IMessage interface.It is more diffult to proceed.I think you should look through the SDK document.

Guest dheeraj
Posted

hey thx for being in touch, i was able to get the sender's name but i still am struggling to get the bosy if the message, but am at it, will go through the sdk, thx a ton, and further help will be appreciated on how to stream the message body propely.....thx

Guest dheeraj
Posted

hi again

when i try to read the message(SMS) body using the following code -

hr = m_pMessage->OpenProperty(PR_BODY, &IID_IStream, STGM_READ, NULL, (LPUNKNOWN *) &pStream);

I get the following link error --

error LNK2001: unresolved external symbol IID_IStream

Can anyone guide me how to work over this problem, which header or library files to include to resove this error....

thx....

Guest awarner [MVP]
Posted

MAPI only contains SENT sms and emails not the contents of the inbox

this is contained in cemail.vol

Posted
hi again

when i try to read the message(SMS) body using the following code -

hr = m_pMessage->OpenProperty(PR_BODY, &IID_IStream, STGM_READ, NULL, (LPUNKNOWN *) &pStream);

I get the following link error --

error LNK2001: unresolved external symbol IID_IStream

Can anyone guide me how to work over this problem, which header or library files to include to resove this error....

thx....

IID_IStream is defined somewhere.You can simplly ignore it.Do like below:

m_pMessage->OpenProperty(PR_BODY, NULL, 0, MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*)&pStream);

Guest dheeraj
Posted

hi there

well no luck with your method of OpenProperty...also as mentioned by awarner i would like to know how to read the contents of cemail.vol file...thx

Posted
hi there

well no luck with your method of OpenProperty...also as mentioned by awarner i would like to know how to read the contents of cemail.vol file...thx

I don't think you still have a link problem.....

Guest awarner [MVP]
Posted

Have a look on www.monolithix.org and download DB view app :)

Guest dheeraj
Posted

hi all!

well till now i'm struggling to fetch the body of SMS from the inbox, i could only fetch the sender's name, the link problem still persists...any help will be appreciated, thx!!

  • 2 weeks later...
Guest Sv1000
Posted

Hi,

Is Someone could put a code to read a SMS from Inbox ?

Please, help me !!! :)

Seb = = = o>°o

Guest rcperez
Posted

how do you turn of the darnit save sent in your spv's inbox? I tried entering an extra entry in the registry SaveSent = 0, tried doing it in options, Save Sent Items to off - still no go.

Any Ideas?

  • 4 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.