我想创建带提醒的备注,这是我的代码:
'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 消息=未将对象引用设置到对象的实例。
答案 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)