简体   繁体   English

如何按序号搜索注释

[英]How can I search Notes by sequence number

I use Evernote C# API. 我使用Evernote C#API。 I understand how filters working. 我了解过滤器的工作原理。

ENNoteStoreClient store = ENSessionAdvanced.SharedSession.PrimaryNoteStore;
            SyncState currentState = store.GetSyncState();
            int currentUpdateCount = currentState.UpdateCount;

            if (currentUpdateCount > latestUpdateCount)
            {
                latestUpdateCount = currentUpdateCount;
                // Here synchronization code
            }

I have latestUpdateCount and how I can get notes with sequence number >= this number? 我有latestUpdateCount,如何获得序列号> =该数字的注释?

You'll want to use GetFilteredSyncChunk using code something like the following: 您将需要使用类似以下代码的GetFilteredSyncChunk

List<SyncChunk> syncBlocks = new List<SyncChunk>();
int maxEntries = 250;

// These are sample filter settings; you should use what's appropriate for you based on
// what data you want returned in your note objects.
SyncChunkFilter filter = new SyncChunkFilter();
filter.IncludeNotes = true;
filter.IncludeNoteAttributes = true;
filter.IncludeNotebooks = true;
filter.IncludeTags = false;
filter.IncludeSearches = false;
filter.IncludeResources = false;
filter.IncludeLinkedNotebooks = false;
filter.IncludeExpunged = false;
filter.IncludeNoteApplicationDataFullMap = false;
filter.IncludeResourceApplicationDataFullMap = false;
filter.IncludeNoteResourceApplicationDataFullMap = false;

do
{
    SyncChunk chunk = store.getFilteredSyncChunk(currentUpdateCount, maxEntries, filter);
    if (chunk == null)
    {
        return null;      // This can happen if there is a "503 - Service unavailable" error accessing this person's Evernote info
    }
    syncBlocks.Add(chunk);
    currentUpdateCount = chunk.ChunkHighUSN;
} while (currentUpdateCount < serverSyncState.UpdateCount);

foreach (SyncChunk chunk in syncBlocks)
{
    if (chunk != null && chunk.Notes != null)
    {
        foreach (Note chunkNote in chunk.Notes)
        {
            // do something with the retrieved chunkNote object
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM