How do I create/locate a document (C++)?

How do I do this (C++ API).

  1. Create a new document with a particular title (title: some unique ID) and add it to a folder.

  2. The document contents are just an XML blob (attachment?).

  3. Locate this document when it exists and open it directly.

I can’t seem to find how to set the document subject and how to find this document later…

Thx

dB.

Subject: How do I create/locate a document (C++)?

what exactly are the problems. create a document, set fields you like (see “Adding items to a note” in docu).

depending on the size of xml you can also create an attachment (LNNote::CreateAttachment).

to find it later you could create a view and located it by subject (LNViewFolder::Find)? or save noteid/unid and get it directly (LNDatabase::GetDocument).

Markus Seitz

markus.seitz@icodex.com

Subject: RE: How do I create/locate a document (C++)?

I wasn’t quite understanding how this works (since we have some fantastic documentation here) at the time of writing. So I’ll explain this to whoever is reading it.

The main thing is that documents exist without folders, this is a flat store. Documents need a form and there’s a default form for documents.

LNDocument lndoc;

lnDb.CreateDocument(& lndoc);

LNString MySubjectString(“VP Test Subject”);

LNText MySubjectText;

MySubjectText << MySubjectString;

lndoc.CreateItem(“Subject”, MySubjectText, LNITEMFLAGS_SUMMARY, LNITEMOPTION_DELETE_APPEND);

LNString MyBodyString(“Bla bla”);

LNText MyBodyText;

MyBodyText << MyBodyString;

lndoc.CreateItem(“Body”, MyBodyText, LNITEMFLAGS_NONE, LNITEMOPTION_DELETE_APPEND);

lndoc.Save();

You can then do

folder.FolderAddDocument(lndoc);

cheers

dB.