我的Node.Js应用程序我需要过滤使用
提取的笔记findNotesMetadata
这样它只会从具有特定GUID的笔记本中提取笔记。
我知道我可以使用
noteFilter
这样做。
但是我可以将几个笔记本ID传递给它吗?怎么样?
谢谢!
答案 0 :(得分:2)
您需要为每个笔记本调用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'?