无法在vb.net中列出Evernote标签

时间:2017-11-25 11:54:05

标签: vb.net evernote

我无法在vb.net

中列出与evernote笔记相关联的标签

注释正确显示其标题,但标记名为[无] ......

我做错了什么?这是我使用的代码:

Imports System
Imports EvernoteSDK
Imports System.IO
Imports System.Collections.Generic
Imports EvernoteSDK.Advanced

Public class main
dim myResultsList As List(Of ENSessionFindNotesResult)
    ENSession.SetSharedSessionConsumerKey("KEY", "SECRET")

        If ENSession.SharedSession.IsAuthenticated = False Then
            ENSession.SharedSession.AuthenticateToEvernote()




myResultsList = ENSession.SharedSession.FindNotes(ENNoteSearch.NoteSearch("text to find"), Nothing, ENSession.SearchScope.All, ENSession.SortOrder.RecentlyUpdated, 500)

                  ' Given a NoteRef instance, download that note.
            Dim myDownloadedNote As ENNote = ENSession.SharedSession.DownloadNote(myResultsList(0).NoteRef)

            For i As Integer = 0 To myDownloadedNote.TagNames.Count - 1
                Note_tags_txt.Text = Note_tags_txt.Text + " " + myDownloadedNote.TagNames.Item(i)
            Next
end class 

2 个答案:

答案 0 :(得分:0)

您不会使用笔记返回注释标记名称 - 您将获得标记guids。你也可以 1.使用listTags将标签guig交叉引用到名称,或 2.使用getNoteTagNames直接获取注释标记名称。

答案 1 :(得分:0)

嗯......我最终自己弄清楚了......我不得不说Evernote的vb.net SDK文档很少。

首先,我必须拥有以下进口货物

    Imports System
    Imports EvernoteSDK
    Imports System.IO
    Imports System.Collections.Generic
    Imports EvernoteSDK.Advanced
    Imports EvernoteSDK.Advanced.ENNoteStoreClient
    Imports Evernote.EDAM.NoteStore
    Imports Evernote.EDAM.Type
    Imports Evernote.EDAM.UserStore

然后我必须分两步授权应用程序:

    ENSession.SetSharedSessionConsumerKey("KEY", "SECRET")
    ENSessionAdvanced.SetSharedSessionConsumerKey("KEY", "SECRET")

    If ENSession.SharedSession.IsAuthenticated = False Then
        ENSession.SharedSession.AuthenticateToEvernote()
    End If 

其中" KEY"和" SECRET"是Evernote分配的API令牌。

由于我使用了错误的代码,我必须清除 c:\ users \%username%\ appdata \ local \ evernote 中的所有文件,如果我不这样做,我会收到EDAM错误。

说我对获取标签名称感兴趣的注释来自搜索字符串" textToFind"的结果,我可以得到所有匹配的注释:

     Dim myResultsList As List(Of ENSessionFindNotesResult) = _
ENSession.SharedSession.FindNotes(ENNoteSearch.NoteSearch(textToFind), Nothing, _
ENSession.SearchScope.All, ENSession.SortOrder.RecentlyUpdated, 500)

上述搜索可以限制在特定笔记本上,替换为“#34; no"用相应的笔记本。

说我对基于零的结果列表的第一个音符的标签感兴趣,然后:

     Dim note_ref As ENNoteRef = myResultsList(0).NoteRef

     ' Given a NoteRef instance, download that note.
     Dim myDownloadedNote As ENNote = ENSession.SharedSession.DownloadNote(note_ref)
     Dim s = ENSessionAdvanced.SharedSession.NoteStoreForNoteRef(note_ref)
     Dim Tags_List As List(Of String) = s.GetNoteTagNames(note_ref.Guid)

这样,Tags_List将包含一个标签名称列表作为字符串。然后是我的其余代码:

    For i As Integer = 0 To Tags_List.Count - 1
            If i = 0 Then
                Note_tags_txt.Text = Tags_List.Item(0)
            Else
                Note_tags_txt.Text = Note_tags_txt.Text + " - " + Tags_List.Item(i)
            End If
    Next i

Note_Tags_Txt是我在表单上创建的标签。

我希望这有助于某人。