IMAPITable->Restrict() always returns E_INVALIDARG

Tech-Archive recommends: Fix windows errors by optimizing your registry



I've seen this same questions asked many different places on the web but I've never seen a response.

The following question was originally asked by "vjsharm":

i am trying to filter messages using IMAPITABLES's Restrict function.
but on its usage it returns E_INVALIDARGS as result.

here's code for ur reference.

HRESULT FilterMessagesExt()
{
HRESULT hRes;
LPSRowSet pRows = NULL;
SRestriction sres;
SPropValue spv;
LPMAPIFOLDER pFldr;
LPMAPITABLE pCTbl;
ULONG lCount ;
SRowSet *prowset = NULL;
HRESULT hr = S_OK;
SizedSPropTagArray(1,spt) = {1,PR_SENDER_NAME };

//this is my utility function to return the folder
pFldr=OpenFolder(Inboxfolder);
hRes = pFldr->GetContentsTable(0,&pCTbl);

// select columns first
hRes = pCTbl->SetColumns((LPSPropTagArray)&spt,0);

// sort depends on result of Restrict, do first
sres.rt = RES_PROPERTY;
spv.ulPropTag =PR_SENDER_NAME ;
spv.Value.lpszW = (LPWSTR)("Sharma, Kapil");
sres.res.resProperty.relop = RELOP_NE;
sres.res.resProperty.ulPropTag =PR_SENDER_NAME;
sres.res.resProperty.lpProp = &spv;

//here hRes gets E_INVALIDARGS as result
hRes = pCTbl->Restrict(&sres,TBL_BATCH);
pCTbl->GetRowCount(0,&lCount);

return hRes;
}

--------------------------

I've tried using various types of properties such as PR_MESSAGE_DELIVERY_TIME and PR_LAST_MODIFICATION_TIME but it always returns E_INVALID_ARG. The MSDN documentation says IMAPITable->Restrict is supported on Pocket PC 2002 or later as long as "rt" equals RES_PROPERTY.

Any ideas?


.



Relevant Pages

  • Re: WMI access from multiple COM objects, how to?
    ... enter the object path and use AddObject ... > - It happens all the time on AddObjectByPath function call. ... > call returns HRESULT S_OK though. ... > HRESULT hRes; ...
    (microsoft.public.win32.programmer.wmi)
  • Re: COleClientItem und Recordset
    ... HRESULT MakeSelector(CComBSTR &strSQLSel, CComBSTR strRecordset, VARIANT ... HRESULT hRes = S_FALSE; ... CString sBuff; ...
    (microsoft.public.de.vc)
  • Re: COleClientItem und Recordset
    ... HRESULT MakeSelector(CComBSTR &strSQLSel, CComBSTR strRecordset, VARIANT ... HRESULT hRes = S_FALSE; ... CString sBuff; ...
    (microsoft.public.de.vc)
  • Re: MemoryMappedFiles oder nicht?
    ... alle Eigenschaften die eine Datenbank abbildet. ... HRESULT ReadFromStream(IStream *pStream); ... HRESULT hRes = StgOpenStorage( ...
    (microsoft.public.de.vc)