Read-Only Notes

Understanding the contentClass attribute


Overview

Some applications such as Evernote Food and Evernote Hello create notes that are intended to be read-only when viewed in other applications.

What is a read-only note?

As the name suggests, read-only notes are notes that can be viewed but not modified by most applications. Applications may only modify such a note's notebook and tags. An application creates read-only notes when it needs to rely on a specific structure within the note's ENML content. If other applications were to modify the note's content, the structure might be changed, rendering the note unreadable to the application that created it.

How to indicate that a note is read-only and why

When creating a note, it should be set as read-only if it contains special structured information that requires special rules when making modifications to the note body. A note is marked as read-only by setting the Note.attributes.contentClass field. Applications that encounter a note with a non-empty contentClass must treat the note as read-only unless they explicitly support the specified content class.

The contentClass field indicates the type of content contained in the note body. Note bodies must still be valid ENML. The contentClass attribute indicates that the ENML content follows a specific structure.

Third-party applications may create read-only notes by using a contentClass of the format companyName.appName[.noteType] (e.g. microsoft.word.document). Before you choose to set the contentClass and create read-only, be sure to consider if it is definitely necessary - the user loses some functionality when a note is not editable in an Evernote client application.

Searching for notes with a specific contentClass

You can search for notes with a specific contentClass by including contentClass:string in your search term (the NoteFilter.words field). You can include a trailing wildcard, e.g. contentClass:evernote.hello.*.

Examples of read-only notes

Notes created by Evernote Food and Evernote Hello are read-only when viewed in other Evernote clients. The contentClass for Food notes is evernote.food.meal, while Hello uses evernote.hello.profile and evernote.hello.encounter.

Stay on top of what's happening in the Evernote developer community.