Read-only archive of the All About Symbian forum (2001–2013) · About this archive

ImportContactsL() problem

1 replies · 1,961 views · Started 12 October 2004

Hi,

I have tried the following:

TBool importSuccessful;
RDesReadStream iDesRead(aDes);
CArrayPtr<CContactItem>* contact =
contactsDb->ImportContactsL(KVersitEntityUidVCard, iDesRead,
importSuccessful, CContactDatabase.EIncludeX);

But get the following compilation error:

error C2664: 'ImportContactsL' : cannot convert parameter 1 from 'const int'
to 'const class TUid &'

But the documentation says that the first parameter has to be
KVersitEntityUidVCard, so I don't understand the error:

ImportContactsL()
CArrayPtr<CContactItem>* ImportContactsL(const TUid& aFormat,RReadStream&
aReadStream,TBool& aImportSuccessful,TInt aOption);

Description
Imports one or more vCards from a read stream. The vCards are converted into
contact items, and added to the database. If at least one contact item was
successfully imported, aImportSuccessful is set to ETrue. If
EImportSingleContact is specified in aOption, the read stream marker is left
at the next position, ready to read the next contact item. The caller takes
ownership of the returned object.

Parameters
const TUid& aFormat Indicates the format for imported and
exported contacts. Its value must be KVersitEntityUidVCard.

RReadStream& aReadStream The stream to read from.

TBool& aImportSuccessful On return, ETrue if at least one
contact was successfully imported. EFalse if not.

TInt aOption Indicates the options for import and export. See
the TOptions enum.

Return value
CArrayPtr<CContactItem>* The array of contact items imported.

Leave codes
KErrNotSupported aFormat.iUid is not KVersitEntityUidVCard.

What is really KVersitEntityUidVCard? It doesn't seem to be in the documentation.

I found that the following works to get the call to ImportContactsL to compile:

[FONT="Courier New"]TUid versit = {KVersitEntityUidVCard};
iContacts->ImportContactsL(versit, rr, importSuccessful, CContactDatabase::EImportSingleContact);
[/FONT]

where rr is an object of type RReadStream. and importSuccessful is a TBool.