Property samples
Basics
In almost all methods, you'll see the parameter named "nodeId". The value of this parameter can be a valid document, folder, mail, or record UUID.
Example of a nodeId:
- Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db"
Suggested code sample
First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then you should log in using the method "login". You can access the "login" method from the webservice object "ws" as shown below:
ws.login(user, password);
Once you are logged in to the webservices, the session is kept in the webservice object. Then you can use the other API methods.
At this point you can use all the repository methods from "repository" class, as shown below:
ws.property.addCategory("eee9d70f-6af9-4783-82a7-b8ac94c234b6", "58c9b25f-d83e-4006-bd78-e26d7c6fb648");
Methods
addCategory
Description:
Method | Return values | Description |
---|---|---|
addCategory(String nodeId, String catId) |
void |
Sets a relation between a category and a node. |
The value of the catId parameter should be a category folder UUID or path. |
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);
try
{
ws.login(user, password);
ws.property.addCategory("f123a950-0329-4d62-8328-0ff500fd42db", "055e4384-7c70-4456-b32b-f5a55a79861f");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
removeCategory
Description:
Method | Return values | Description |
---|---|---|
removeCategory(String nodeId, String catId) |
void |
Removes a relation between a category and a node. |
The value of the catId parameter should be a category folder UUID or path. |
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);
try
{
ws.login(user, password);
ws.property.removeCategory("f123a950-0329-4d62-8328-0ff500fd42db", "ac165cab-a62a-4b17-89fc-2480a1d784db");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
addKeyword
Description:
Method | Return values | Description |
---|---|---|
addKeyword(String nodeId, String keyword) |
void |
Adds a keyword to a node. |
The keyword should be a single word without spaces, formats allowed:
Also, we suggest that you add a keyword in lowercase format because OpenKM is case-sensitive. |
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);
try
{
ws.login(user, password);
ws.property.addKeyword("f123a950-0329-4d62-8328-0ff500fd42db", "test");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
removeKeyword
Description:
Method | Return values | Description |
---|---|---|
removeKeyword(String nodeId, String keyword) |
void |
Removes a keyword from a node. |
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);
try
{
ws.login(user, password);
ws.property.removeKeyword("f123a950-0329-4d62-8328-0ff500fd42db", "test");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setSigned
Description:
Method | Return values | Description |
---|---|---|
setSigned(String nodeId, boolean signed) |
void |
Marks a document's binary data as signed or unsigned in the repository. |
The parameter nodeId should be a document node. This method does not perform any kind of digital signature process; it simply marks in the database that a document is signed. |
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);
try
{
ws.login(user, password);
ws.property.setSigned("f123a950-0329-4d62-8328-0ff500fd42db", true);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
isSigned
Description:
Method | Return values | Description |
---|---|---|
isSigned(String uuid) |
bool |
Returns a boolean indicating whether the document is signed. |
The parameter uuid should be a document node. |
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);
try
{
ws.login(user, password);
System.Console.WriteLine("Is the document signed: " + ws.property.isSigned("6330d2a0-529f-4c14-baa1-ce6a92004e01").ToString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}