03-09-2012 12:22 PM
Does anyone have a good example of how to use the NoteModifier Method to create a note on a document? I have been unable to find any information or examples on this in the API documentation. Thanks..
03-12-2012 07:06 AM
You can find the information about the NoteModifier class in the SDK under Unity API > Reference > Hyland.Unity Namespace > NoteModifier Class. This class is used to create a NoteProperties object that will actually create the Note, and then the NoteModifier will add the Note to the Document.
The following is a very basic method of creating a note on a document in C# (although easily translatable to VB.Net). All of the classes used a fully documented in the Reference section of the Unity API in the SDK.
Document doc = app.Core.GetDocumentByID(101);
NoteType noteType = app.Core.NoteTypes.Find("Yellow Note");
NoteModifier noteMod = doc.CreateNoteModifier();
// Create the NoteProperties
NoteProperties noteProps = noteMod.CreateNoteProperties();
noteProps.Text = "New note text";
noteProps.PageNumber = 2;
// Create the Note
Note newNote = noteType.CreateNote(noteProps);
noteMod.AddNote(newNote);
noteMod.ApplyChanges(); // Must apply changes.
03-14-2012 09:47 AM
Thanks Tim... This was what I was looking for.
03-14-2012 12:43 PM
I am having trouble updating/removing an existing note on a document. The document.note.find doesn't seem to work the way I think it should.
Thanks
03-14-2012 01:14 PM
The Find method off of NoteList has 3 overloads. First, a long for the Note ID. Next, a string of the Auto-Name string of the Note. Third, a Predicate(T) where T is a Note object and the predicate returns bool.
So, to find a Note based on the NoteType ID, the third overload is needed. Using a lambda expression, it would look like: document.Notes.Find( (note) => {return note.NoteType.ID == noteTypeID});
This, of course, would only return 1 note, even if there are multiple notes . The FindAll method works the same as the predicate example, but will return a NoteList.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.