2017-02-14 1 views
0

ich eine Notiz mit Erinnerung erstellen möchten, ist dies mein Code:Wie eine Notiz mit Attributen „ReminderTime“ erstellen

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

aber es hat nicht funktioniert. Der Fehlercode:

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

Ausführliche Informationen:.

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

+0

Mögliches Duplikat von [Was ist eine NullReferenceException, und wie behebe ich sie?] (Http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix- es) –

+0

Entschuldigung, ich verstehe dich nicht.Könnten Sie bitte noch einmal im Detail erklären? – 6lilu9

+0

'myNote.Attributes' ist wahrscheinlich null –

Antwort

1

einer Note Attribute sind ein NoteAttributes Objekt, so dass Sie zuerst das Objekt erstellen müssen:

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

ja, es hat perfekt funktioniert, danke.Wo kann ich ein paar Tutorials wie dieses finden? – 6lilu9

+0

Leider sind keine Tutorials für das Evernote Windows SDK verfügbar. Aber Sie können hier bei Bedarf weitere Fragen stellen. –

+0

Auch, da meine Antwort für Sie arbeitete, wäre es toll, wenn Sie meine Antwort als die akzeptierte Antwort identifizieren könnten. Vielen Dank! –

Verwandte Themen