Evernote php - 从链接笔记本中获取笔记

时间:2017-07-12 21:07:56

标签: php evernote

我正在使用此SDK - https://github.com/evernote/evernote-cloud-sdk-php

我可以在自己的笔记本中找到笔记,如下所示:

$client = new \Evernote\Client($token, false);

$search = new \Evernote\Model\Search('*');

$notebook = $client->getNotebook('notebook_id');

$scope = \Evernote\Client::SEARCH_SCOPE_ALL;

$order = \Evernote\Client::SORT_ORDER_REVERSE | \Evernote\Client::SORT_ORDER_RECENTLY_CREATED;

$results = $client->findNotesWithSearch($search, $notebook, $scope, $order, 20);

它可以工作,但是如果我尝试从链接的笔记本中获取笔记,它会一直得到空的结果。

试过这个 - https://dev.evernote.com/doc/articles/sharing.php

$adClient = new \Evernote\AdvancedClient($token ,false);

$store = $adClient->getSharedNoteStore('linked_notbook_id');

$client = new \Evernote\Client($store->getToken(), false);

$search = new \Evernote\Model\Search('*');

$notebook = $carrier->getLinkedNotebooks()[0];

$scope = \Evernote\Client::SEARCH_SCOPE_ALL;

$order = \Evernote\Client::SORT_ORDER_REVERSE | \Evernote\Client::SORT_ORDER_RECENTLY_CREATED;

$results = $client->findNotesWithSearch($search, $notebook, $scope, $order, 20);

同样的空洞结果。

1 个答案:

答案 0 :(得分:0)

$carrier来自何处?

$notebook = $carrier->getLinkedNotebooks()[0];

假设它$client,来自SharedNoteStore的LinkedNotebook已分配给$notebook,并且会传递给findNotesWithSearch,这似乎不对。

  1. LinkedNotebook对象适用于与笔记本共享的用户。因此,使用SharedNoteStore调用该API可能不是您想要的。请参阅https://dev.evernote.com/doc/articles/sharing.php
  2. findNotesWithSearch的第二个参数类型为Notebook。 notebookGuid可以在SharedNotebook
  3. 中找到