如何创建具有属性的笔记"ReminderTime"

How to create a note with Attributes"ReminderTime"

我想创建一个带提醒的便条,这是我的代码:

'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 Message=未将对象引用设置到对象的实例。

笔记的属性是一个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)