Property samples
Basics
On almost 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 nodeId:
- Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db"
Suggested code sample
First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then should login using the method "login". You can access the "login" method from webservice object "ws" as is shown below:
ws.login(user, password);
Once you are logged with the webservices the session is keep in the webservice Object. Then you can use the other API method
At this point you can use all the Repository methods from "repository" class as is 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 and a node. |
The keyword should be a single word without spaces, formats allowed:
Also, we suggest you add a keyword in lower case 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());
}
}
}
}
setEncryption
Description:
Method | Return values | Description |
---|---|---|
setEncryption(String nodeId, String cipherName) |
void |
Marks a document as an encrypted binary data into the repository |
The parameter nodeId should be a document node. The parameter cipherName saves information about the encryption mechanism. This method does not perform any kind of encryption, simply mark into the database that a document is encrypted. |
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.setEncryption("f123a950-0329-4d62-8328-0ff500fd42db", "phrase");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
unsetEncryption
Description:
Method | Return values | Description |
---|---|---|
unsetEncryption(String nodeId) |
void |
Marks a document as a normal binary data into repository. |
The parameter nodeId should be a document node. This method does not perform any kind of uncryption, simply mark into the database that a document has been uncrypted. |
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.unsetEncryption("f123a950-0329-4d62-8328-0ff500fd42db");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setSigned
Description:
Method | Return values | Description |
---|---|---|
setSigned(String nodeId, boolean signed) |
void |
Marks a document assigned or unsigned binary data into the repository |
The parameter nodeId should be a document node. This method does not perform any kind of digital signature process, simply mark into 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 that indicates if the document is signed or not. |
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());
}
}
}
}