本文整理汇总了C++中LPMAPITABLE::SeekRow方法的典型用法代码示例。如果您正苦于以下问题:C++ LPMAPITABLE::SeekRow方法的具体用法?C++ LPMAPITABLE::SeekRow怎么用?C++ LPMAPITABLE::SeekRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPMAPITABLE
的用法示例。
在下文中一共展示了LPMAPITABLE::SeekRow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IterateHierarchy
BOOL CMapiApi::IterateHierarchy( CMapiHierarchyIter *pIter, LPMAPIFOLDER pFolder, ULONG flags)
{
// flags can be CONVENIENT_DEPTH or 0
// CONVENIENT_DEPTH will return all depths I believe instead
// of just children
HRESULT hr;
LPMAPITABLE lpTable;
hr = pFolder->GetHierarchyTable( flags, &lpTable);
if (HR_FAILED(hr)) {
m_lastError = hr;
MAPI_TRACE2( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
ULONG rowCount;
hr = lpTable->GetRowCount( 0, &rowCount);
if (!rowCount) {
lpTable->Release();
return( TRUE);
}
hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
if (HR_FAILED(hr)) {
m_lastError = hr;
lpTable->Release();
MAPI_TRACE2( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
if (HR_FAILED(hr)) {
m_lastError = hr;
lpTable->Release();
MAPI_TRACE2( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
int cNumRows = 0;
LPSRowSet lpRow;
BOOL keepGoing = TRUE;
BOOL bResult = TRUE;
do {
lpRow = NULL;
hr = lpTable->QueryRows( 1, 0, &lpRow);
if(HR_FAILED(hr)) {
MAPI_TRACE2( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr);
m_lastError = hr;
bResult = FALSE;
break;
}
if(lpRow) {
cNumRows = lpRow->cRows;
if (cNumRows) {
LPENTRYID lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
ULONG cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
if (pIter)
keepGoing = pIter->HandleHierarchyItem( oType, cb, lpEntry);
else
keepGoing = HandleHierarchyItem( oType, cb, lpEntry);
}
FreeProws( lpRow);
}
} while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
lpTable->Release();
if (bResult && !keepGoing)
bResult = FALSE;
return( bResult);
}
示例2: IterateStores
BOOL CMapiApi::IterateStores( CMapiFolderList& stores)
{
stores.ClearAll();
if (!m_lpSession) {
MAPI_TRACE0( "IterateStores called before session is open\n");
m_lastError = -1;
return( FALSE);
}
HRESULT hr;
/* -- Some Microsoft sample code just to see if things are working --- *//*
ULONG cbEIDStore;
LPENTRYID lpEIDStore;
hr = HrMAPIFindDefaultMsgStore( m_lpSession, &cbEIDStore, &lpEIDStore);
if (HR_FAILED(hr)) {
MAPI_TRACE0( "Default message store not found\n");
// MessageBox(NULL,"Message Store Not Found",NULL,MB_OK);
}
else {
LPMDB lpStore;
MAPI_TRACE0( "Default Message store FOUND\n");
hr = m_lpSession->OpenMsgStore( NULL, cbEIDStore,
lpEIDStore, NULL,
MDB_NO_MAIL | MDB_NO_DIALOG, &lpStore);
if (HR_FAILED(hr)) {
MAPI_TRACE1( "Unable to open default message store: 0x%lx\n", hr);
}
else {
MAPI_TRACE0( "Default message store OPENED\n");
lpStore->Release();
}
}
*/
LPMAPITABLE lpTable;
hr = m_lpSession->GetMsgStoresTable( 0, &lpTable);
if (FAILED(hr)) {
MAPI_TRACE0( "GetMsgStoresTable failed\n");
m_lastError = hr;
return( FALSE);
}
ULONG rowCount;
hr = lpTable->GetRowCount( 0, &rowCount);
MAPI_TRACE1( "MsgStores Table rowCount: %ld\n", rowCount);
hr = lpTable->SetColumns( (LPSPropTagArray)&ptaTbl, 0);
if (FAILED(hr)) {
lpTable->Release();
MAPI_TRACE2( "SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr);
m_lastError = hr;
return( FALSE);
}
hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
if (FAILED(hr)) {
lpTable->Release();
MAPI_TRACE2( "SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr);
m_lastError = hr;
return( FALSE);
}
int cNumRows = 0;
LPSRowSet lpRow;
BOOL keepGoing = TRUE;
BOOL bResult = TRUE;
do {
lpRow = NULL;
hr = lpTable->QueryRows( 1, 0, &lpRow);
if(HR_FAILED(hr)) {
MAPI_TRACE2( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr);
bResult = FALSE;
m_lastError = hr;
break;
}
if(lpRow) {
cNumRows = lpRow->cRows;
if (cNumRows) {
LPCTSTR lpStr = (LPCTSTR) lpRow->aRow[0].lpProps[itblPR_DISPLAY_NAME].Value.LPSZ;
LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[itblPR_ENTRYID].Value.bin.lpb;
ULONG cbEID = lpRow->aRow[0].lpProps[itblPR_ENTRYID].Value.bin.cb;
// In the future, GetStoreInfo needs to somehow return
// whether or not the store is from an IMAP server.
// Currently, GetStoreInfo opens the store and attempts
// to get the hierarchy tree. If the tree is empty or
// does not exist, then szContents will be zero. We'll
//.........这里部分代码省略.........
示例3: IterateContents
BOOL CMapiApi::IterateContents( CMapiContentIter *pIter, LPMAPIFOLDER pFolder, ULONG flags)
{
// flags can be 0 or MAPI_ASSOCIATED
// MAPI_ASSOCIATED is usually used for forms and views
HRESULT hr;
LPMAPITABLE lpTable;
hr = pFolder->GetContentsTable( flags, &lpTable);
if (FAILED(hr)) {
MAPI_TRACE2( "GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
ULONG rowCount;
hr = lpTable->GetRowCount( 0, &rowCount);
if (!rowCount) {
MAPI_TRACE0( " Empty Table\n");
}
hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
if (FAILED(hr)) {
lpTable->Release();
MAPI_TRACE2( "SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
if (FAILED(hr)) {
lpTable->Release();
MAPI_TRACE2( "SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr);
return( FALSE);
}
int cNumRows = 0;
LPSRowSet lpRow;
BOOL keepGoing = TRUE;
BOOL bResult = TRUE;
do {
lpRow = NULL;
hr = lpTable->QueryRows( 1, 0, &lpRow);
if(HR_FAILED(hr)) {
MAPI_TRACE2( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr);
bResult = FALSE;
break;
}
if(lpRow) {
cNumRows = lpRow->cRows;
if (cNumRows) {
LPENTRYID lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
ULONG cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
ULONG oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
keepGoing = HandleContentsItem( oType, cbEID, lpEID);
MAPI_TRACE1( " ObjectType: %ld\n", oType);
}
FreeProws( lpRow);
}
} while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
lpTable->Release();
return( bResult);
}
示例4: IterateWABContents
HRESULT CWAB::IterateWABContents(CWabIterator *pIter, int *pDone)
{
if (!m_bInitialized || !m_lpAdrBook)
return( E_FAIL);
ULONG ulObjType = 0;
LPMAPITABLE lpAB = NULL;
ULONG cRows = 0;
LPSRowSet lpRowAB = NULL;
LPABCONT lpContainer = NULL;
int cNumRows = 0;
nsresult keepGoing;
HRESULT hr = E_FAIL;
ULONG lpcbEID = 0;
LPENTRYID lpEID = NULL;
ULONG rowCount = 0;
ULONG curCount = 0;
nsString uniStr;
// Get the entryid of the root PAB container
//
hr = m_lpAdrBook->GetPAB( &lpcbEID, &lpEID);
if (HR_FAILED( hr))
goto exit;
ulObjType = 0;
// Open the root PAB container
// This is where all the WAB contents reside
//
hr = m_lpAdrBook->OpenEntry(lpcbEID,
(LPENTRYID)lpEID,
NULL,
0,
&ulObjType,
(LPUNKNOWN *)&lpContainer);
m_lpWABObject->FreeBuffer(lpEID);
lpEID = NULL;
if(HR_FAILED(hr))
goto exit;
// Get a contents table of all the contents in the
// WABs root container
//
hr = lpContainer->GetContentsTable( 0,
&lpAB);
if(HR_FAILED(hr))
goto exit;
hr = lpAB->GetRowCount( 0, &rowCount);
if (HR_FAILED(hr))
rowCount = 100;
if (rowCount == 0)
rowCount = 1;
// Order the columns in the ContentsTable to conform to the
// ones we want - which are mainly DisplayName, EntryID and
// ObjectType
// The table is gauranteed to set the columns in the order
// requested
//
hr =lpAB->SetColumns( (LPSPropTagArray)&ptaEid, 0 );
if(HR_FAILED(hr))
goto exit;
// Reset to the beginning of the table
//
hr = lpAB->SeekRow( BOOKMARK_BEGINNING, 0, NULL );
if(HR_FAILED(hr))
goto exit;
// Read all the rows of the table one by one
//
do {
hr = lpAB->QueryRows(1, 0, &lpRowAB);
if(HR_FAILED(hr))
break;
if(lpRowAB)
{
cNumRows = lpRowAB->cRows;
if (cNumRows)
{
LPTSTR lpsz = lpRowAB->aRow[0].lpProps[ieidPR_DISPLAY_NAME].Value.lpszA;
LPENTRYID lpEID = (LPENTRYID) lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
//.........这里部分代码省略.........
示例5: DelFavoriteFolder
/**
* Remove a favorite in the private store. also the sub favorites will be deleted
*
* @param lpShortcutFolder The shortcut folder in the private store.
* @param lpPropSourceKey Pointer to the sourcekey of a favorite folder
*/
HRESULT DelFavoriteFolder(IMAPIFolder *lpShortcutFolder, LPSPropValue lpPropSourceKey)
{
HRESULT hr = hrSuccess;
LPMAPITABLE lpTable = NULL;
LPSRestriction lpRestriction = NULL;
SRowSet *lpRows = NULL;
LPENTRYLIST lpsMsgList = NULL;
SizedSPropTagArray(2, sPropDelFavo) = {2, { PR_ENTRYID, PR_FAV_PUBLIC_SOURCE_KEY }};
std::list<string> listSourceKey;
std::list<string>::iterator ilistSourceKey;
string strSourceKey;
SPropValue sPropSourceKey;
ULONG ulMaxRows = 0;
if (lpShortcutFolder == NULL || lpPropSourceKey == NULL) {
hr = MAPI_E_INVALID_PARAMETER;
goto exit;
}
hr = lpShortcutFolder->GetContentsTable(0, &lpTable);
if (hr != hrSuccess)
goto exit;
hr = lpTable->GetRowCount(0, &ulMaxRows);
if (hr != hrSuccess)
goto exit;
hr = lpTable->SetColumns((LPSPropTagArray)&sPropDelFavo, 0);
if (hr != hrSuccess)
goto exit;
// build restriction
CREATE_RESTRICTION(lpRestriction);
CREATE_RES_AND(lpRestriction, lpRestriction, 1);
DATA_RES_PROPERTY(lpRestriction, lpRestriction->res.resAnd.lpRes[0], RELOP_EQ, PR_FAV_PUBLIC_SOURCE_KEY, lpPropSourceKey);
if (lpTable->FindRow(lpRestriction, BOOKMARK_BEGINNING , 0) != hrSuccess)
goto exit; // Folder already removed
hr = lpTable->QueryRows (1, 0, &lpRows);
if (hr != hrSuccess)
goto exit;
if (lpRows->cRows == 0)
goto exit; // Folder already removed
hr = MAPIAllocateBuffer(sizeof(ENTRYLIST), (void**)&lpsMsgList);
if (hr != hrSuccess)
goto exit;
hr = MAPIAllocateMore(sizeof(SBinary)*ulMaxRows, lpsMsgList, (void**)&lpsMsgList->lpbin);
if (hr != hrSuccess)
goto exit;
//FIXME: check the properties in the row!!!!
lpsMsgList->cValues = 0;
// add entryid
lpsMsgList->lpbin[lpsMsgList->cValues].cb = lpRows->aRow[0].lpProps[0].Value.bin.cb;
MAPIAllocateMore(lpsMsgList->lpbin[lpsMsgList->cValues].cb, lpsMsgList, (void **) &lpsMsgList->lpbin[lpsMsgList->cValues].lpb);
memcpy(lpsMsgList->lpbin[lpsMsgList->cValues].lpb, lpRows->aRow[0].lpProps[0].Value.bin.lpb, lpsMsgList->lpbin[lpsMsgList->cValues].cb);
lpsMsgList->cValues++;
strSourceKey.assign((char*)lpRows->aRow[0].lpProps[1].Value.bin.lpb, lpRows->aRow[0].lpProps[1].Value.bin.cb);
listSourceKey.push_back(strSourceKey);
if (lpRows){ FreeProws(lpRows); lpRows = NULL; }
FREE_RESTRICTION(lpRestriction);
for(ilistSourceKey = listSourceKey.begin(); ilistSourceKey != listSourceKey.end(); ilistSourceKey++)
{
sPropSourceKey.ulPropTag = PR_FAV_PUBLIC_SOURCE_KEY;
sPropSourceKey.Value.bin.cb = ilistSourceKey->size();
sPropSourceKey.Value.bin.lpb = (LPBYTE)ilistSourceKey->c_str();
CREATE_RESTRICTION(lpRestriction);
CREATE_RES_AND(lpRestriction, lpRestriction, 1);
DATA_RES_PROPERTY(lpRestriction, lpRestriction->res.resAnd.lpRes[0], RELOP_EQ, PR_FAV_PARENT_SOURCE_KEY, &sPropSourceKey);
hr = lpTable->Restrict(lpRestriction, TBL_BATCH );
if (hr != hrSuccess)
goto exit;
hr = lpTable->SeekRow(BOOKMARK_BEGINNING, 0, NULL);
if (hr != hrSuccess)
goto exit;
while(true)
{
hr = lpTable->QueryRows (1, 0, &lpRows);
if (hr != hrSuccess)
//.........这里部分代码省略.........
示例6: EnumList
nsresult nsOEAddressIterator::EnumList(const char16_t * pName, LPENTRYID pEid, ULONG cbEid, LPMAPITABLE lpTable)
{
// If no name provided then we're done.
if (!pName || !(*pName))
return NS_OK;
nsresult rv = NS_ERROR_FAILURE;
HRESULT hr = E_FAIL;
// Make sure we have db to work with.
if (!m_database)
return rv;
nsCOMPtr <nsIMdbRow> listRow;
rv = m_database->GetNewListRow(getter_AddRefs(listRow));
NS_ENSURE_SUCCESS(rv, rv);
rv = m_database->AddListName(listRow, NS_ConvertUTF16toUTF8(pName).get());
NS_ENSURE_SUCCESS(rv, rv);
rv = m_database->AddCardRowToDB(listRow);
NS_ENSURE_SUCCESS(rv, rv);
rv = m_database->AddListDirNode(listRow);
NS_ENSURE_SUCCESS(rv, rv);
LPSRowSet lpRowAB = NULL;
ULONG lpcbEID = 0;
LPENTRYID lpEID = NULL;
ULONG rowCount = 0;
int cNumRows = 0;
int numListElems = 0;
nsAutoString uniStr;
hr = lpTable->GetRowCount(0, &rowCount);
//
hr = lpTable->SeekRow(BOOKMARK_BEGINNING, 0, NULL);
if(HR_FAILED(hr))
return NS_ERROR_FAILURE;
// Read all the rows of the table one by one
do
{
hr = lpTable->QueryRows(1, 0, &lpRowAB);
if(HR_FAILED(hr))
break;
if(lpRowAB)
{
cNumRows = lpRowAB->cRows;
if (cNumRows)
{
LPTSTR lpsz = lpRowAB->aRow[0].lpProps[ieidPR_DISPLAY_NAME].Value.lpszA;
LPENTRYID lpEID = (LPENTRYID) lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
ULONG cbEID = lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
// There are 2 kinds of objects - the MAPI_MAILUSER contact object
// and the MAPI_DISTLIST contact object
// For distribution lists, we will only consider MAILUSER
// objects since we can't nest lists yet.
if(lpRowAB->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.l == MAPI_MAILUSER)
{
LPMAILUSER pUser = m_pWab->GetUser(cbEID, lpEID);
LPSPropValue pProp = m_pWab->GetUserProperty(pUser, PR_EMAIL_ADDRESS);
nsString eMail;
nsCOMPtr <nsIMdbRow> cardRow;
m_pWab->GetValueString(pProp, eMail);
SanitizeValue(eMail);
FindListRow(eMail, getter_AddRefs(cardRow));
if (cardRow)
{
nsCOMPtr <nsIAbCard> userCard;
nsCOMPtr <nsIAbCard> newCard;
userCard = do_CreateInstance(NS_ABMDBCARD_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
m_database->InitCardFromRow(userCard,cardRow);
m_database->AddListCardColumnsToRow(userCard, listRow, ++numListElems,
getter_AddRefs(newCard),
true, nullptr, nullptr);
}
m_pWab->FreeProperty(pProp);
m_pWab->ReleaseUser(pUser);
}
}
m_pWab->FreeProws(lpRowAB);
}
} while (SUCCEEDED(hr) && cNumRows && lpRowAB);
m_database->SetListAddressTotal(listRow, numListElems);
return rv;
}
示例7: ReadWAB
BOOL ReadWAB(LPADRBOOK pAdrBook,
LPWABOBJECT pWABObject,
AdrBookTable **ppTable,
UINT *pNumEntries)
{
ULONG ulObjType = 0;
LPMAPITABLE lpAB = NULL;
LPTSTR * lppszArray=NULL;
ULONG cRows = 0;
LPSRowSet lpRow = NULL;
LPSRowSet lpRowAB = NULL;
LPABCONT lpContainer = NULL;
int cNumRows = 0;
int nRows=0;
int nCount = 0;
HRESULT hr = E_FAIL;
ULONG lpcbEID;
LPENTRYID lpEID = NULL;
// Get the entryid of the root PAB container
//
hr = pAdrBook->GetPAB( &lpcbEID, &lpEID);
ulObjType = 0;
// Open the root PAB container
// This is where all the WAB contents reside
//
hr = pAdrBook->OpenEntry(lpcbEID,
(LPENTRYID)lpEID,
NULL,
0,
&ulObjType,
(LPUNKNOWN *)&lpContainer);
pWABObject->FreeBuffer(lpEID);
lpEID = NULL;
if(HR_FAILED(hr))
goto exit;
// Get a contents table of all the contents in the
// WABs root container
//
hr = lpContainer->GetContentsTable( 0,
&lpAB);
if(HR_FAILED(hr))
goto exit;
// Order the columns in the ContentsTable to conform to the
// ones we want - which are mainly DisplayName, EntryID and
// ObjectType
// The table is gauranteed to set the columns in the order
// requested
//
hr =lpAB->SetColumns( (LPSPropTagArray)&ptaEid, 0 );
if(HR_FAILED(hr))
goto exit;
// Reset to the beginning of the table
//
hr = lpAB->SeekRow( BOOKMARK_BEGINNING, 0, NULL );
if(HR_FAILED(hr))
goto exit;
// Read all the rows of the table one by one
//
do {
hr = lpAB->QueryRows(1, 0, &lpRowAB);
if(HR_FAILED(hr))
break;
if(lpRowAB)
{
cNumRows = lpRowAB->cRows;
if (cNumRows)
{
LPTSTR szName = lpRowAB->aRow[0].lpProps[ieidPR_DISPLAY_NAME].Value.lpszA;
LPTSTR szEmail = NULL;
LPENTRYID lpEID = (LPENTRYID) lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
ULONG cbEID = lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
LPMAILUSER pMailUser = NULL;
ULONG ulObjType = 0;
ULONG ulValues;
LPSPropValue lpPropArray;
*ppTable = (AdrBookTable *) realloc(*ppTable,
sizeof(AdrBookTable) * (nCount+1));
(*ppTable)[nCount].szName =
//.........这里部分代码省略.........