×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    18

    Getting timestamp of item fields of contacts

    Hi,

    I'm trying to get the timestamp of item fields of a contact item (which could be different from the timestamp of the contact item itself). However, I'm unable to access the DateTimeStorage() function of CContactItemField class.

    My code is:

    CContactDatabase *cdb;

    cdb=CContactDatabase::OpenL();

    // Open the contact, pushing it onto the cleanup stack.
    CContactItem *contact = cdb->OpenContactLX(aEvent.iContactId);

    // Modification time of Contact Item
    TTime ctime = contact->LastModified();

    CContactItemFieldSet& fieldSet = contact->CardFields();

    CContactDateField *modifDate = fieldSet[0].DateTimeStorage(); /* --- CRASH HERE --- */

    // Modification time of Item Field
    TTime ftime = modifDate->Time();


    My code crashes on the line indicated above. Could you please tell me where I'm going wrong.

    T.I.A.

    cmc77

  2. #2
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    113

    Only one modified date per contact...

    The following code will only work if the field happens to be a DateTime field in the field set. You'll probably find that its a text field and hence the panic...

    CContactDateField *modifDate = fieldSet[0].DateTimeStorage(); /* --- CRASH HERE --- */

    Use 'fieldSet[0].StorageType()' to identify the field type before accessing, that way you know what to expect when extracting the field's data.

    The problem is, each field is not date stamped on modification, only the entire contact...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×