I've not played with C# so this may need a bit of interpretation on your part.
The return value from the API call is an error code (0 for no error). Error codes are bits so are pretty much unreadable To get the error in a readable format you will need to do a bit more work. The following is using C e.g:
STATUS string_id = ERR(_error); // this removes mask bits from the returned error that can cause the next call to return duff info. ERR() is a macro to do the work for you.
WORD text_len;
char error_text[MAXSPRINTF];
text_len = OSLoadString(NULLHANDLE,
string_id,
error_text,
sizeof(error_text)); // this will get the string related to the error code.
If however you want to use the error codes directly these are mostly defined in the xxxerr.h of the type you are using (in your case nsferr.h), here's a bit of it...
#define ERR_DIRECTORY PKG_NSF+28
errortext(ERR_DIRECTORY, "This function is inappropriate for file system directories.")
#define ERR_NOT_DIRECTORY PKG_NSF+29
errortext(ERR_NOT_DIRECTORY, "This function is only appropriate for directories.")
#define ERR_ITEM_DEF_TYPE PKG_NSF+30
internaltext(ERR_ITEM_DEF_TYPE, "Cannot add item def - type unknown")
#define ERR_BUCKET_STRUCT PKG_NSF+31
internaltext(ERR_BUCKET_STRUCT, "Invalid structure in bucket")
As it's C what you get back from the call NSFNoteOpenExt is an error code and a handle to the note you are after (in your case the handle is hNote). The note handle is then used in other calls to get at fields within the note.
Looking at the example BlogMIME.cs as soon as there is an error it exits without identifying the error:
if (stat >0)
goto XEnd;
You may want to manually check that the noteID that you are using is in the database first. This can be done with the admin client, or if you have a test database with one document in it you can check the properties of the document.
In the above the noteID is B496. If however the noteID that you have is more like 80000000 then that is not actually a note, that's a category (a sudo noteID used in views).