내 작업은 주어진 날짜 사이의 모든 메일을 검색하는 매우 간단합니다.MAPI API를 사용하여 특정 날짜 사이에 특정 메일 검색
나는 IMAPITable::Restrict
전화를 사용하거나 직접 pHrQueryAllRows
으로 지정해야한다는 것을 알고 있지만 Microsoft에서 제공 한 API를 고려할 때 너무 복잡해 보입니다. 내가 날짜 x와 y 사이의 메일을 검색하기 위해 다음과 같은 구조체를 사용하려면 어떻게해야
typedef struct _SRestriction
{
ULONG rt; /* Restriction type */
union
{
SComparePropsRestriction resCompareProps; /* first */
SAndRestriction resAnd;
SOrRestriction resOr;
SNotRestriction resNot;
SContentRestriction resContent;
SPropertyRestriction resProperty;
SBitMaskRestriction resBitMask;
SSizeRestriction resSize;
SExistRestriction resExist;
SSubRestriction resSub;
SCommentRestriction resComment;
SAnnotationRestriction resAnnotation; // OFFICEDEV: not backwards compatible with Office 11 and older
SCountRestriction resCount; // OFFICEDEV: not backwards compatible with Office 11 and older
} res;
} SRestriction;
:
는 SRestriction 구조체 (Mapidefs.h로)을 감안할 때?
편집 :
SPropValue* pStartTime = nullptr;
pfnMAPIAllocateBuffer_(sizeof(SPropValue),
reinterpret_cast<LPVOID*>(&pStartTime));
ZeroMemory(pStartTime, sizeof(SPropValue));
SPropValue* pStopTime = nullptr;
pfnMAPIAllocateBuffer_(sizeof(SPropValue),
reinterpret_cast<LPVOID*>(&pStopTime));
ZeroMemory(pStopTime, sizeof(SPropValue));
SRestriction* pConditions = nullptr;
pfnMAPIAllocateBuffer_(sizeof(SRestriction) * 2,
reinterpret_cast<LPVOID*>(&pConditions));
pConditions[0].rt = RES_PROPERTY;
pConditions[0].res.resProperty.relop = RELOP_GT;
pStartTime->ulPropTag =
pConditions[0].res.resProperty.ulPropTag =
PR_MESSAGE_DELIVERY_TIME;
//////////////
SYSTEMTIME stStart = { 0 };
stStart.wSecond=0;
stStart.wMinute=0;
stStart.wHour=9;
stStart.wDay=1;
stStart.wMonth=1;
stStart.wYear=2017;
FILETIME ftStart;
SystemTimeToFileTime(&stStart, &ftStart);
pStartTime->Value.ft = ftStart;
///////////////
pConditions[0].res.resProperty.lpProp = pStartTime;
pConditions[1].rt = RES_PROPERTY;
pConditions[1].res.resProperty.relop = RELOP_LE;
pStopTime->ulPropTag =
pConditions[1].res.resProperty.ulPropTag =
PR_MESSAGE_DELIVERY_TIME;
//////////////
SYSTEMTIME stStop = { 0 };
stStop.wSecond = 0;
stStop.wMinute=12;
stStop.wHour=14;
stStop.wDay=18;
stStop.wMonth=1;
stStop.wYear=2017;
FILETIME ftStop;
SystemTimeToFileTime(&stStop, &ftStop);
pStartTime->Value.ft = ftStop;
///////////////
pConditions[1].res.resProperty.lpProp = pStopTime;
spSRestriction_.reset(new SRestriction); //#igal add deallocation
spSRestriction_->rt = RES_AND;
spSRestriction_->res.resAnd.cRes = 2;
spSRestriction_->res.resAnd.lpRes = pConditions;
이것은 하나의 필드이므로 한 번에 하나씩 필드를 채울 필요가 없습니다. 나는 당신이 필요하다고 생각한다. 그리고 두 가지 소품 제한 (시작일보다 좋고 종료일보다 큼)이 포함 된 제한 –