I have written cmd line application, which add, edit, delete and display notes. When i add a note it is not getting updated in the address book. when i search for the note in cmd line am able to retrieve it back. How do i over come this.
Subject: Re: Adding note through C API
After you create and edit the note, I’m assuming you are using NSFNoteComputeWithForm, NSFNoteUpdate, and finally NSFNoteClose to have the form compute any necessary items in the note along with saving it to the database (using NSFNoteUpdate). Also you’re setting the Form item to “Person” to use the Person form? If you create a note without the Person form it will still be a valid note, yet you won’t be able to see it in your contacts view. Also if NSFNoteUpdate isn’t called then it won’t ever be written back to the database, you can still access it your program for it’s in memory, yet won’t be able to see it in the database.
Subject: Re: Adding note through C API
Hi Hawley,First i want u to thank for the reply. I am the same way as you mentioned, to be more clear can you pls look at the sample code below
CreateNote()
{
//Some variable declaration
if (NSFNoteCreate(g_hdb, &hNote) == sRes)
{
printf("\nEnter the First Name: ");
scanf("%s", cStr);
if(NO_ERROR != NSFItemAppend(hNote, ITEM_NAMES, "FirstName", strlen("FirstName"), TYPE_TEXT, cStr, strlen(cStr)))
{
OSLoadString(NULLHANDLE, ERR(sRes), cError, NULL); // Change to NOERROR
printf("NSFItemAppend: %s.\n", cError);
return false;
}
// Get remaining fileds
if(NO_ERROR != NSFNoteUpdate(hNote, UPDATE_FORCE))
{
OSLoadString(NULLHANDLE, ERR(sRes), cError, NULL);
printf("NSFNoteUpdateExtended: %s.\n", cError);
return false;
}
}
else
return false;
if (NO_ERROR != NSFNoteComputeWithForm (hNote, NULLHANDLE, (DWORD) 0, NULL, NULL))
{
OSLoadString(NULLHANDLE, ERR(sRes), cError, NULL);
printf("NSFItemAppend: %s.\n", cError);
return false;
}
if(sRes != NSFNoteClose(hNote))
{
OSLoadString(NULLHANDLE, ERR(sRes), cError, NULL);
printf("Error: %s.\n", cError);
return false;
}
return true;