在我的Node.Js应用中,我需要过滤使用提取的注释
findNotesMetadata
因此它仅从具有某些GUID的笔记本中提取笔记。
我知道我可以用
noteFilter
要做到这一点。
但是我可以将几个笔记本ID传递给它吗?如何?
谢谢!
最佳答案
您将需要为每个笔记本调用findNotesMetadata。
以下是一些示例代码,可从默认笔记本中检索所有笔记并记录笔记标题:
Evernote = require('evernote').Evernote;
var authToken = "your developer token";
if (authToken == "your developer token") {
console.log("Please fill in your developer token");
console.log("To get a developer token, visit https://sandbox.evernote.com/api/DeveloperToken.action");
process.exit(1);
}
var client = new Evernote.Client({token: authToken, sandbox: true});
var userStore = client.getUserStore();
var noteStore = client.getNoteStore();
var notebook=noteStore.getDefaultNotebook(function (err, notebook){
//create filter for findNotesMetadata
filter = new Evernote.NoteFilter();
//set the notebook guid filter to the GUID of the default notebook
filter.notebookGuid = notebook.guid;
//create a new result spec for findNotesMetadata
resultSpec = new Evernote.NotesMetadataResultSpec();
//set the result spec to include titles
resultSpec.includeTitle=true;
//call findNotesMetadata on the note store
noteStore.findNotesMetadata(filter, 0, 100, resultSpec, function(err, notesMeta) {
if (err) {
console.error('err',err);
}
else {
//log the number of notes found in the default notebook
console.log("Found "+notesMeta.notes.length+" notes in your default notebook . . .")
for (var i in notesMeta.notes) {
//list the title of each note in the default notebook
console.log(i+": "+notesMeta.notes[i].title);
}
}});
});
样本输出:
Found 3 notes in your default notebook . . .
0: This is a test note!
1: Hello Developer Forums!!!
2: How are you doin'?