Node samples
Basics
Section titled “Basics”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 Node methods from the “node” class as shown below:
ws.node.getNodeByUuid("29a22996-0e3b-421e-8759-c24ea41c1ebb")Methods
Section titled “Methods”getVersionHistory
Section titled “getVersionHistory”Description:
| Method | Return values | Description |
|---|---|---|
| getVersionHistory(String uuid) | List |
Returns a list of the version history of a document. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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); List<Version> versions = ws.node.getVersionHistory("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}restoreVersion
Section titled “restoreVersion”Description:
| Method | Return values | Description |
|---|---|---|
| restoreVersion(String uuid, String versionName) | void | Restore a document to a specific version. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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.node.restoreVersion("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7","1.0"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}deleteVersion
Section titled “deleteVersion”Description:
| Method | Return values | Description |
|---|---|---|
| deleteVersion(String uuid, String versionName) | void | Delete a specific version. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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.node.deleteVersion("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7","1.0"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}purgeVersionHistory
Section titled “purgeVersionHistory”Description:
| Method | Return values | Description |
|---|---|---|
| purgeVersionHistory(String uuid) | void | Purge the version history of a document. |
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);
try { ws.login(user, password); ws.node.purgeVersionHistory("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}compactVersion
Section titled “compactVersion”Description:
| Method | Return values | Description |
|---|---|---|
| compactVersion(String uuid, String versionName) | Version | Compacts the indicated version with its immediate previous one into a single history entry, and returns the resulting Version object. |
Useful when a content operation (checkin/create) is immediately followed by a separate metadata operation (property group added/changed), which would otherwise be stored as two consecutive versions instead of one.
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);
try { ws.login(user, password); Version compacted = ws.node.compactVersion("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7", "1.3"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}mayBePromotedAsRecord
Section titled “mayBePromotedAsRecord”Description:
| Method | Return values | Description |
|---|---|---|
| mayBePromotedAsRecord(String uuid, bool fullEvaluation) | PromoteAsRecordEvaluation | Returns a PromoteAsRecordEvaluation object. |
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);
try { ws.login(user, password); ws.node.mayBePromotedAsRecordNode("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7", false); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}promoteAsRecord
Section titled “promoteAsRecord”Description:
| Method | Return values | Description |
|---|---|---|
| promoteAsRecord(String uuid) | void | Promote as a record. |
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);
try { ws.login(user, password); ws.node.promoteAsRecord("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}isElectronicRecordPath
Section titled “isElectronicRecordPath”Description:
| Method | Return values | Description |
|---|---|---|
| isElectronicRecordPath(String uuid) | Boolean | Returns true if the node is an electronic record. |
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);
try { ws.login(user, password); bool isERP = ws.node.isElectronicRecordPath("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}degradeRecord
Section titled “degradeRecord”Description:
| Method | Return values | Description |
|---|---|---|
| degradeRecord(String uuid) | void | Degrade a record. |
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);
try { ws.login(user, password); ws.node.degradeRecord("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getElectronicRecordInPath
Section titled “getElectronicRecordInPath”Description:
| Method | Return values | Description |
|---|---|---|
| getElectronicRecordInPath(String uuid) | Record | Get the electronic record in the path. |
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);
try { ws.login(user, password); Record record = ws.node.getElectronicRecordInPath("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}subscribe
Section titled “subscribe”Description:
| Method | Return values | Description |
|---|---|---|
| subscribe(String uuid) | void | Adds a subscription to 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);
try { ws.login(user, password); ws.node.subscribe("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}unsubscribe
Section titled “unsubscribe”Description:
| Method | Return values | Description |
|---|---|---|
| unsubscribe(String uuid) | void | Deletes a subscription from 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);
try { ws.login(user, password); ws.node.unsubscribe("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}importZip
Section titled “importZip”Description:
| Method | Return values | Description |
|---|---|---|
| importZip(String uuid, FileStream content) | void | Import a zip file. |
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);
try { ws.login(user, password); String folderId = "70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"; FileStream zipFile = new FileStream("D:\\Test.zip", FileMode.Open, FileAccess.Read); ws.node.importZip(folderId, zipFile); zipFile.Close(); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}exportZip
Section titled “exportZip”Description:
| Method | Return values | Description |
|---|---|---|
| exportZip(List |
Stream | Export as a zip file. |
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);
try { ws.login(user, password); List<string> uuids = new List<string>(); uuids.Add("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"); uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"); // Get strem exportZip Stream s = ws.node.exportZip(uuids, true, true); // Save as zip file FileStream zipFile = new FileStream("D:\\Testing\\Test.zip", FileMode.OpenOrCreate, FileAccess.ReadWrite); s.CopyTo(zipFile); zipFile.Close(); s.Close(); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}Description:
| Method | Return values | Description |
|---|---|---|
| unZip(String uuid, String dstId) | void | Unzip a file. |
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);
try { ws.login(user, password); String zipFileId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; String folderId = "70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7"; ws.node.unZip(zipFileId, folderId); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getNodeByUuid
Section titled “getNodeByUuid”Description:
| Method | Return values | Description |
|---|---|---|
| getNodeByUuid(String uuid) | Node | Get a node by UUID. |
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);
try { ws.login(user, password); Node node = ws.node.getNodeByUuid("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"); System.Console.WriteLine(node.toString()); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getChildrenNodesPaginated
Section titled “getChildrenNodesPaginated”Description:
| Method | Return values | Description |
|---|---|---|
| getChildrenNodesPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List |
SimpleNodeBaseList | Get paginated child nodes. |
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);
try { ws.login(user, password); List<int> filteredTypes = new List<int>(); filteredTypes.Add(1); String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; ChildNodeList nodeList = ws.node.getChildrenNodesPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes);
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getChildrenNodesPaginated
Section titled “getChildrenNodesPaginated”Description:
| Method | Return values | Description |
|---|---|---|
| getChildrenNodesPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List |
SimpleNodeBaseList | Get children nodes paginated. |
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);
try { ws.login(user, password); List<int> filteredTypes = new List<int>(); filteredTypes.Add(1); String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; ChildNodeList nodeList = ws.node.getChildrenNodesPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes, "");
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getChildrenNodesByCategoryPaginated
Section titled “getChildrenNodesByCategoryPaginated”Description:
| Method | Return values | Description |
|---|---|---|
| getChildrenNodesByCategoryPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List |
SimpleNodeBaseList | Get children nodes by category paginated. |
| The parameters “limit” and “offset” allow you to retrieve only a portion of the results of a query. - The parameter “limit” is used to limit the number of results returned. - The parameter “offset” skips that many results before beginning to return results. For example, if your query has 1000 results, but you only want to return the first 10, you should use these values: - limit=10 - offset=0 Now suppose you want to show the results from 11-20, you should use these values: - limit=10 - offset=10 |
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);
try { ws.login(user, password); List<int> filteredTypes = new List<int>(); filteredTypes.Add(1); String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; ChildNodeList nodeList = ws.node.getChildrenNodesByCategoryPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes);
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getChildrenNodesByCategoryPaginated
Section titled “getChildrenNodesByCategoryPaginated”Description:
| Method | Return values | Description |
|---|---|---|
| getChildrenNodesByCategoryPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List |
SimpleNodeBaseList | Get children nodes by category paginated. |
| The parameters “limit” and “offset” allow you to retrieve only a portion of the results of a query. - The parameter “limit” is used to limit the number of results returned. - The parameter “offset” skips that many results before beginning to return results. For example, if your query has 1000 results, but you only want to return the first 10, you should use these values: - limit=10 - offset=0 Now suppose you want to show the results from 11-20, you should use these values: - limit=10 - offset=10 |
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);
try { ws.login(user, password); List<int> filteredTypes = new List<int>(); filteredTypes.Add(1); String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; ChildNodeList nodeList = ws.node.getChildrenNodesByCategoryPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes, "");
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getBreadcrumb
Section titled “getBreadcrumb”Description:
| Method | Return values | Description |
|---|---|---|
| getBreadcrumb(String uuid) | List |
Get the breadcrumb. |
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);
try { ws.login(user, password); String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"; List<BreadCrumbItem> list = ws.node.getBreadcrumb(folderId);
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getNodesFiltered
Section titled “getNodesFiltered”Description:
| Method | Return values | Description |
|---|---|---|
| getNodesFiltered(List |
List |
Returns a node list. |
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);
try { ws.login(user, password); List<string> uuids = new List<string>(); uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"); List<Node> nodes = ws.node.getNodesFiltered(uuids); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}evaluateDownloadZip
Section titled “evaluateDownloadZip”Description:
| Method | Return values | Description |
|---|---|---|
| evaluateDownloadZip(List |
ZipDownloadEvaluationResult | Returns a ZipDownloadEvaluationResult object. |
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);
try { ws.login(user, password); List<string> uuids = new List<string>(); uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801"); ZipDownloadEvaluationResult zdeResult = ws.node.evaluateDownloadZip(uuids); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}generateDownloadToken
Section titled “generateDownloadToken”Description:
| Method | Return values | Description |
|---|---|---|
| generateDownloadToken(String uuid, bool preview, bool oneTimeUse, DateTime? validUntil) | String | Generates a node download link. |
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); DateTime? validUntil = new DateTime(2023, 2, 10); System.Console.WriteLine(ws.node.generateDownloadToken("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7", true, false, validUntil)); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}restore
Section titled “restore”Description:
| Method | Return values | Description |
|---|---|---|
| restore(String uuid) | Node | Restore 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);
try { ws.login(user, password); Node node = ws.node.restore("0f6463f3-4d36-4091-b518-4fe7c353ee70"); System.Console.WriteLine(node.toString());
} catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}hasNodesLockedByOtherUser
Section titled “hasNodesLockedByOtherUser”Description:
| Method | Return values | Description |
|---|---|---|
| hasNodesLockedByOtherUser(String uuid) | bool | Indicates if the node is blocked by other users. |
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);
try { ws.login(user, password); if(ws.node.hasNodesLockedByOtherUser("1ec49da9-1746-4875-ae32-9281d7303a62")) { System.Console.Writeline("Is blocked"); } } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}setComment
Section titled “setComment”Description:
| Method | Return values | Description |
|---|---|---|
| setComment(String uuid, String versionName, String comment) | void | Sets the comment for a specific node version. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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.node.setComment("4b88cbe9-e73d-45fc-bac0-35e0d6e59e43", "1.5", "Update comment"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getPaginatorConfig
Section titled “getPaginatorConfig”Description:
| Method | Return values | Description |
|---|---|---|
| getPaginatorConfig(String pluginName) | NodePaginatorConfig | Returns a NodePaginatorConfig object. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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); NodePaginatorConfig nodePaginatorConfig = ws.node.getPaginatorConfig("com.openkm.plugin.paginate.TestNodePaginator"); Console.WriteLine(nodePaginatorConfig.toString()); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getPaginatorPlugins
Section titled “getPaginatorPlugins”Description:
| Method | Return values | Description |
|---|---|---|
| getPaginatorPlugins() | PaginatorPluginList | Returns a PaginatorPluginList object. |
Example:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;using com.openkm.sdk4csharp.impl;
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); PaginatorPluginList list = ws.node.getPaginatorPlugins(); foreach(PaginatorPlugin paginatorPlugin in list.paginatorPlugins) { Console.WriteLine("Name: " + paginatorPlugin.name); Console.WriteLine("ObjClass: " + paginatorPlugin.objClass); } } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}Description:
| Method | Return values | Description |
|---|---|---|
| lock(String uuid) | LockInfo | Locks a node and returns an object with the Lock information. |
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);
try { ws.login(user, password); ws.node.lock("f123a950-0329-4d62-8328-0ff500fd42db"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}forceLock
Section titled “forceLock”Description:
| Method | Return values | Description |
|---|---|---|
| forceLock(String uuid) | LockInfo | Force-locks a node and returns an object with the lock information. |
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);
try { ws.login(user, password); ws.node.forceLock("f123a950-0329-4d62-8328-0ff500fd42db"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}unlock
Section titled “unlock”Description:
| Method | Return values | Description |
|---|---|---|
| unlock(String uuid) | LockInfo | Force-unlocks a locked 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);
try { ws.login(user, password); ws.node.unlock("f123a950-0329-4d62-8328-0ff500fd42db"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}forceUnlock
Section titled “forceUnlock”Description:
| Method | Return values | Description |
|---|---|---|
| forceUnlock(String uuid) | void | Unlocks a locked node. |
This method allows unlocking any locked document.
It is not necessary that this action be executed by the same user who previously performed the checkout lock action.
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.node.forceUnlock("f123a950-0329-4d62-8328-0ff500fd42db"); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}