Skip to content
Other versions

Loading…

Note samples

On most methods, you’ll see the parameter named “nodeId”. The value of this parameter can be a valid document, folder, mail or record UUID or path.

Description:

Method Return values Description
addNote(String nodeId, String text) Note Adds a note to a node and returns an object Note.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/OpenKM";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);
try
{
ws.addNote("/okm:root/logo.png", "the note text");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getNote(String noteId) Note Retrieves the note.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/OpenKM";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);
try
{
List<Note> notes = ws.listNotes("/okm:root/logo.png");
if (notes.Count > 0)
{
System.Console.WriteLine(ws.getNote(notes[0].path));
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
deleteNote(String noteId) Note Deletes a note.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/OpenKM";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);
try
{
List<Note> notes = ws.listNotes("/okm:root/logo.png");
if (notes.Count > 0)
{
System.Console.WriteLine(ws.deleteNote(notes[0].path));
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
setNote(String noteId, String text) void Changes the note text.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/OpenKM";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);
try
{
List<Note> notes = ws.listNotes("/okm:root/logo.png");
if (notes.Count > 0)
{
ws.setNote(notes[0].path, "text modified");
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
listNotes(String nodeId) List Retrieves a list of all notes of a node.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/OpenKM";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password);
try
{
List<Note> notes = ws.listNotes("/okm:root/logo.png");
foreach (Note note in notes)
{
System.Console.WriteLine(note);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}