0

I want to create a note with reminder, this is my code:

'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)

but it didn't work. The error code:

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

Full details:

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

CDspace
  • 2,551
  • 17
  • 31
  • 35
6lilu9
  • 1
  • 4

1 Answers1

1

A note's attributes are a NoteAttributesobject, so you have to create the object first:

'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)
Phil Seeman
  • 395
  • 2
  • 11
  • yes,it did work perfectly,thanks.Where can I find some tutorials like this? – 6lilu9 Feb 15 '17 at 20:43
  • Unfortunately there aren't any tutorials available for the Evernote Windows SDK. But you can ask more questions here if needed. – Phil Seeman Feb 17 '17 at 04:35
  • Also, since my answer worked for you, it would be great if you could identify my answer as the Accepted answer. Thanks! – Phil Seeman Feb 17 '17 at 04:36