Help with NSFSearch Formula to Retrieve ParentID

Hi Team,

I am currently using the NSFSearch function to retrieve documents, and it is working as expected. However, I also need to get the ParentID of each document in the result set.

Could you please share the appropriate formula string (hFormula) that I can use with NSFSearch to include or filter based on the ParentID?

Here is the function I’m using:

STATUS LNPUBLIC NSFSearch(

DBHANDLE  hDB,
FORMULAHANDLE  hFormula,
char far *ViewTitle,
WORD  SearchFlags,
WORD  NoteClassMask,
TIMEDATE far *Since,
NSFSEARCHPROC  EnumRoutine,
void far *EnumRoutineParameter,
TIMEDATE far *retUntil);

Thank you for your support.
Thanks

Hi team , any update on this ?

Hi team , any update on this ?

Hi @ritu

Based on your function using (NSFSearch), you get results of documents from the EnumRoutine callback. With that you will receive the NOTEID of each matching document.

For each NOTEID, you will then need to open the document using NSFNoteOpen. Once the document is open, you can access its items. The ParentID is typically stored in the $REF (sometimes $$REF) item. You’ will need use then NSFItemInfo or NSFItemGetText (if you expect it as text) to read this item. The ParentID is a NOTEID, so it’s a UNIVERSALNOTEID (UNID) or a NOTEID structure. See documentation from the following links:

Let me know if you have further questions. Thank you.

Hi TJJabian,

Thank you for your reply.

As per the method parameters, I understand that we can pass the view name (or folder name), and the result will return the corresponding documents. Could you please share the formula and an example of how to use this method to retrieve documents based on the view name?

Thanks

Yes, you can check the samples provided in the following HCL CAPI Github to check the usage of Views and incorporate it in to your code:

Hi TJJabian,

Thank you for your reply.

I Got my answer thanks for this. I have one more query , I want to know unread emails for this i used STATUS error = NIFReadEntries(
hViewCollection, // collection handle
&IndexPos, // where to start
NAVIGATE_NEXT, // skip direction
dwSkipCount, // number to skip
NAVIGATE_NEXT, // return direction
dwFillCount, // number to read
READ_MASK_NOTEID + READ_MASK_INDEXANYUNREAD, // data to return (or add READ_MASK_SUMMARY)
&hBuffer, // output buffer
&wSummarySize, // buffer size (optional)
&dwEntriesSkipped, // skipped count
&dwEntriesReturned, // returned count
&wSignalFlags // signal flags (optional)
); but not getting it. could help me on this how to extract unread status ?

Thanks

I think you have a separate forum post here that is similar to this recent query:

I believe you need to go loop through the dwEntriesReturned in order for you to check the status of each returned NoteID if it has unread or read marks.