Problems about address book (iaddrbook) | developer.brewmp.com Problems about address book (iaddrbook) | developer.brewmp.com

Developer

Problems about address book (iaddrbook)

Forums:

Dear all,

I have two problems while using the iaddrbook api. The problems are listed as follows:

    New SDK version couldn't create AEECLSID_ADDRBOOK

Since SDK rev 2.1, I couldn't create the instance of AEECLSID_ADDRBOOK by the function ISHELL_CreateInstance(pMe->Applet.m_pIShell, AEECLSID_ADDRBOOK, (void**)&pMe->m_addr_book)
However, I could create the instance by earilier SDK. Are there any changes of usage between these versions?

    The enumeration based on a specified search criteria couldn't be done

Walk through all the records in the address book is available; however, walk through records that have a specific name is failed.
I have tried both IADDRBOOK_EnumRecInit() and IADDRBOOK_EnumRecInitEx().
On my code, I save the records on the AEE_ADDR_CAT_PERSONAL category, and I want to retrieve records with a specified name of the field AEE_ADDRFIELD_NAME. The code are as follows:

// case 1: the IADDRBOOK_EnumRecInit() use case
enumbook = IADDRBOOK_EnumRecInit( pMe->m_addr_book, AEE_ADDR_CAT_PERSONAL, AEE_ADDRFIELD_NAME, ppDATA, ppSize);
// The result of IADDRBOOK_EnumNextRec( pMe->m_addr_book) is no records; however, I have a record with the specified name.

//case2: the IADDRBOOK_EnumRecInitEx() use case
enumRecInfo.nCategories = 1;
enumRecInfo.pCatList = cats; // Pointer to the category AEE_ADDR_CAT_PERSONAL
enumRecInfo.nFields = 1;
enumRecInfo.pFieldList = fieldIds; // Pointer to the field AEE_ADDRFIELD_NAME
enumRecInfo.nTypes = 1;
enumRecInfo.pTypeList = types; // Pointer to the type AEEDB_FT_STRING
enumRecInfo.pData = ppDATA;
enumRecInfo.dwDataSize = (uint16)WSTRLEN(ppDATA);
enumRecInfo.flags = ABSF_MATCH_EQUAL;
enumBook = IADDRBOOK_EnumRecInitEx(pMe->m_addr_book, &enumRecInfo);
// The result of IADDRBOOK_EnumNextRec( pMe->m_addr_book) are all records in the address book.

Are there any errors on my code?
Please help me to solve the problem, thanks a lot.

Emily

In order to create an AEECLSID_ADDRBOOK object you need to set the privileges correctly into your cif file.
Look to some my previous posts.
My problem instead is that I populated the address book database with some contacts of type AEE_ADDR_CAT_PERSONAL, but the IADDRBOOK_EnumRecInitEx returns 1, i.e. it fails.
The same bit of code, again, was working with the 3.1.5.
Any ideas what could be wrong?
FYI, the code is simply the following:
AEEAddrEnumRecInfo enumRecInfo;
enumRecInfo.nCategories = 0;
enumRecInfo.nFields = 0;
enumRecInfo.nTypes = 0;
enumRecInfo.dwDataSize = 0;
int nErr = IADDRBOOK_EnumRecInitEx( m_pIAddrBook, &enumRecInfo );

In order to create an AEECLSID_ADDRBOOK object you need to set the privileges correctly into your cif file.
Look to some my previous posts.
My problem instead is that I populated the address book database with some contacts of type AEE_ADDR_CAT_PERSONAL, but the IADDRBOOK_EnumRecInitEx returns 1, i.e. it fails.
The same bit of code, again, was working with the 3.1.5.
Any ideas what could be wrong?
FYI, the code is simply the following:
AEEAddrEnumRecInfo enumRecInfo;
enumRecInfo.nCategories = 0;
enumRecInfo.nFields = 0;
enumRecInfo.nTypes = 0;
enumRecInfo.dwDataSize = 0;
int nErr = IADDRBOOK_EnumRecInitEx( m_pIAddrBook, &enumRecInfo );

I am a new user of BrewMP, I have same problem is when creating contact below as :
nRes=ISHELL_CreateInstance(pMe->Applet.m_pIShell, AEECLSID_ADDRBOOK, (void**)&pMe->m_addr_book)
then value of nRes is 21(EPRIVLEVEL). Can you give me some information for fixed this problem, or provide sample code for create new contact.
Thanks!!

I am a new user of BrewMP, I have same problem is when creating contact below as :
nRes=ISHELL_CreateInstance(pMe->Applet.m_pIShell, AEECLSID_ADDRBOOK, (void**)&pMe->m_addr_book)
then value of nRes is 21(EPRIVLEVEL). Can you give me some information for fixed this problem, or provide sample code for create new contact.
Thanks!!

In your CIF file you need to add the privilege associated to the address book. You may try this out:
Quote:PrivLevel {
AEEPRIVID_PLFile, -- IFileMgr, IDBMgr
AEEPRIVID_PLDownload, -- IDownload
AEEPRIVID_PLSharedWrite, -- Write Access - Shared Directory
AEEPRIVID_PLAddrBook, -- Access to Address Book
AEEPRIVID_PLSystem -- System

Hope it helps.

In your CIF file you need to add the privilege associated to the address book. You may try this out:
Quote:PrivLevel {
AEEPRIVID_PLFile, -- IFileMgr, IDBMgr
AEEPRIVID_PLDownload, -- IDownload
AEEPRIVID_PLSharedWrite, -- Write Access - Shared Directory
AEEPRIVID_PLAddrBook, -- Access to Address Book
AEEPRIVID_PLSystem -- System

Hope it helps.

Hi Hanks, emily,
FYI, these privileges are defined in AEEPLPrivs.bid as follows.
#define AEEPRIVID_PLFile 0x0001 // IFileMgr, IDBMgr
#define AEEPRIVID_PLNetwork 0x0002 // INetMgr
#define AEEPRIVID_PLTapi 0x0004 // ITAPI (simple) Access
#define AEEPRIVID_PLWeb 0x0008 // IWeb Access (Also available
#define AEEPRIVID_PLDownload 0x0020 // IDownload
#define AEEPRIVID_PLSharedWrite 0x0040 // Write Access - Shared Directo
#define AEEPRIVID_PLPosLocation 0x0080 // Position location access (ISH
#define AEEPRIVID_PLRinger 0x0100 // Access - Ringer Directory,
#define AEEPRIVID_PLAddrBook 0x0200 // Access to Address Book
#define AEEPRIVID_PLSectorInfo 0x0400 // GetSectorInfo
#define AEEPRIVID_PLSystem 0xffff
If using any of these privileges, your CIF file must include the AEEPLPrivs.bid file as follows.
include "AEEPLPrivs.bid"
Thanks,
Anand

Hi Hanks, emily,
FYI, these privileges are defined in AEEPLPrivs.bid as follows.
#define AEEPRIVID_PLFile 0x0001 // IFileMgr, IDBMgr
#define AEEPRIVID_PLNetwork 0x0002 // INetMgr
#define AEEPRIVID_PLTapi 0x0004 // ITAPI (simple) Access
#define AEEPRIVID_PLWeb 0x0008 // IWeb Access (Also available
#define AEEPRIVID_PLDownload 0x0020 // IDownload
#define AEEPRIVID_PLSharedWrite 0x0040 // Write Access - Shared Directo
#define AEEPRIVID_PLPosLocation 0x0080 // Position location access (ISH
#define AEEPRIVID_PLRinger 0x0100 // Access - Ringer Directory,
#define AEEPRIVID_PLAddrBook 0x0200 // Access to Address Book
#define AEEPRIVID_PLSectorInfo 0x0400 // GetSectorInfo
#define AEEPRIVID_PLSystem 0xffff
If using any of these privileges, your CIF file must include the AEEPLPrivs.bid file as follows.
include "AEEPLPrivs.bid"
Thanks,
Anand