$client = new \\Evernote\\Client($token, $sandbox);
$search = new \\Evernote\\Model\\Search(''); //文字列による絞込みを行わない場合は空文字を指定
$notebook = new \\Evernote\\Model\\Notebook();
$notebook->guid = /* guid */; //空のNotebookモデルにguidを設定すればOK
$scope = \\Evernote\\Client::SEARCH_SCOPE_ALL;
$order = \\Evernote\\Client::SORT_ORDER_NORMAL;
$maxResult = 1000; //制限なしは設定できないみたい。
$results = $client->findNotesWithSearch($search, $notebook, $scope, $order, $maxResult);
notebookは、noteStoreから取得できるものとはクラスが異なるので注意。
$note = new \\Evernote\\Model\\Note();
$note->title = 'タイトル';
$note->tagNames = array('tag1', 'tag2');
$note->content = new \\Evernote\\Model\\PlainTextNoteContent('ABC');
$notebook = new \\Evernote\\Model\\Notebook();
$notebook->guid = xxx; //保存先ノートブックのGUID
$createNote = $client->uploadNote($note, $notebook);
//$createNote->guid で作成されたノートのGUIDを取得できる
ノートコンテンツとして用意されているクラスは以下
PlainTextNoteContent
$note->content = new \\Evernote\\Model\\PlainTextNoteContent('ABC');
EnmlNoteContent
$content = <<<CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "<http://xml.evernote.com/pub/enml2.dtd>">
<en-note><div>ABC</div></en-note>
CONTENT;
$note->content = new \\Evernote\\Model\\EnmlNoteContent($content);
HtmlNoteContent
ルートタグ内の情報を抽出して更新する。
$client = new \\Evernote\\Client($token, $sandbox);
$currentNote = $client->getNote($source_guid);
$inner_content = getInnerNontent($currentNote);
$new_note = $currentNote;
$new_note->content = '冒頭に追記<br/>'.$inner_content;
$client->replaceNote($currentNote, $new_note);
# --------------------------------
# ノードのコンテンツ(en-noteタグ内)を返します
# --------------------------------
function getInnerNontent($note) {
//<en-note>内を取得する
$pattern = '<en-note>(.*)</en-note>';
preg_match_all('{'.$pattern.'}', $note->content, $matches, PREG_SET_ORDER);
foreach($matches as $match) {
$inner_content = $match[1];
}
return $inner_content;
}
コンテンツの登録は必須。コンテンツを指定しないとエラーになるので注意。