Working with metadata in Note formats

GroupDocs.Metadata for .NET provides functionality that allows working with ONE files created by different versions of Microsoft OneNote. Please see the code samples below for more information.

Inspecting Note documents

The inspection feature that is introduced in this section doesn’t work with metadata directly but extracts some useful pieces of information that can be considered as metadata under some circumstances. For example, you may want to obtain information about pages in a note document. Please follow the example below to learn how to do that.

  1. Load a Note document
  2. Extract the root metadata package
  3. Use the InspectionPackage property to inspect the document

AdvancedUsage.ManagingMetadataForSpecificFormats.Document.Note.NoteReadInspectionProperties

using (Metadata metadata = new Metadata(Constants.InputOne))
{
	var root = metadata.GetRootPackage<NoteRootPackage>();

	if (root.InspectionPackage.Pages != null)
	{
		foreach (var page in root.InspectionPackage.Pages)
		{
			Console.WriteLine(page.Title);
			Console.WriteLine(page.Author);
			Console.WriteLine(page.CreationTime);
			Console.WriteLine(page.LastModificationTime);
		}
	}
}

Reading document statistics

Most office applications are able to display simple text statistics for loaded documents. It can be an estimated word count, page count, character count, etc. The GroupDocs.Metadata API provides similar functionality for some document formats. The following code sample demonstrates how to obtain the text statistics for a Note document.

AdvancedUsage.ManagingMetadataForSpecificFormats.Document.Note.NoteReadDocumentStatistics

using (Metadata metadata = new Metadata(Constants.InputOne))
{
    var root = metadata.GetRootPackage<NoteRootPackage>();
    Console.WriteLine(root.DocumentStatistics.CharacterCount);
    Console.WriteLine(root.DocumentStatistics.PageCount);
    Console.WriteLine(root.DocumentStatistics.WordCount);
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

Along with full featured .NET library we provide simple, but powerful free Apps. You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.