Property samples
Basics
Section titled “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.
Suggested code sample
Section titled “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);At this point you can use all the Repository methods from the “repository” class as shown below:
ws.property.addCategory("eee9d70f-6af9-4783-82a7-b8ac94c234b6", "58c9b25f-d83e-4006-bd78-e26d7c6fb648");Methods
Section titled “Methods”addCategory
Section titled “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
Section titled “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
Section titled “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:
- “test”
- “two_words” (the character “_” is used as the separator).
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
Section titled “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
Section titled “setEncryption”Description:
| Method | Return values | Description |
|---|---|---|
| setEncryption(String nodeId, String cipherName) | void | Marks a document as encrypted binary data in the repository. |
The parameter nodeId should be a document node.
The parameter cipherName stores information about the encryption mechanism.
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
Section titled “unsetEncryption”Description:
| Method | Return values | Description |
|---|---|---|
| unsetEncryption(String nodeId) | void | Marks a document as normal binary data in the repository. |
The parameter nodeId 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); ws.property.unsetEncryption("f123a950-0329-4d62-8328-0ff500fd42db"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}setSigned
Section titled “setSigned”Description:
| Method | Return values | Description |
|---|---|---|
| setSigned(String nodeId, boolean signed) | void | Marks a document as signed or unsigned in the repository. |
The parameter nodeId 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); ws.property.setSigned("f123a950-0329-4d62-8328-0ff500fd42db", true); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}isSigned
Section titled “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()); } } }}