public static void CreateSampleNote(bool readOnly, string tag) { EvernoteConnection.Create(); ENNote sampleNote = new ENNote(); if (readOnly) { List <string> tags = new List <string>(); tags.Add(tag); sampleNote.TagNames = tags; sampleNote.Title = "My read-only note"; } else { sampleNote.Title = "My writeable note"; } sampleNote.Content = ENNoteContent.NoteContentWithString("Hello, world! " + DateTime.Now); ENNoteRef noteRef = EvernoteConnection.CurrentSession.UploadNote(sampleNote, null); }
static void Main(string[] args) { EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(READONLY_CONTENT_CLASS), "No contentClass configured."); EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(READONLY_TAG), "No readonly tag configured."); var options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { options.GetUsage(); return; } EvernoteConnection.Create(); if (options.CreateSampleReadOnlyNote) { SampleData.CreateSampleNote(true, READONLY_TAG); } // lock newly-tagged notes SetTaggedNotesToReadOnly(); if (options.Interactive) { // unset - let user remove tags to reset notes to r/w InteractiveRemoveReadOnlyTags(); } // sweep and reset to read-write ResetUntaggedNotesToReadWrite(); if (options.Interactive) { Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }