如何使用属性“ReminderTime”创建注释

时间:2017-02-14 14:58:46

标签: vb.net evernote reminders evernote-app-notebook

我想创建带提醒的备注,这是我的代码:

'Create a note locally.
Dim myNote As New Note()

myNote.Title = "Sample note with Reminder set"
myNote.Content = "Hello, world - this note has a Reminder on it."
myNote.Attributes.ReminderTime = DateTime.Now.ToEdamTimestamp()

'Create the note in the service, in the user's personal, default notebook.
Dim store As ENNoteStoreClient =ENSessionAdvanced.SharedSession.PrimaryNoteStore
Dim resultNote As Note = store.CreateNote(myNote)

但它不起作用。错误代码:

myNote.Attributes.ReminderTime = DateTime.Now.ToEdamTimestamp()

完整详情:

  

未处理System.NullReferenceException HResult = -2147467261         消息=未将对象引用设置到对象的实例。

1 个答案:

答案 0 :(得分:1)

笔记的属性是NoteAttributes对象,因此您必须先创建对象:

'Create a note locally.
Dim myNote As New Note()

myNote.Title = "Sample note with Reminder set"
myNote.Content = "Hello, world - this note has a Reminder on it."

'Create the note's attributes.
Dim myNoteAttributes As New NoteAttributes

myNoteAttributes.ReminderTime = DateTime.Now.ToEdamTimestamp()
myNote.Attributes = myNoteAttributes    

'Create the note in the service, in the user's personal, default notebook.
Dim store As ENNoteStoreClient =ENSessionAdvanced.SharedSession.PrimaryNoteStore
Dim resultNote As Note = store.CreateNote(myNote)