Activity samples
Suggested code sample
Section titled “Suggested code sample”First, you must create the web service object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);Then you should log in using the “login” method. You can access the “login” method from the web service object “ws” as shown below:
ws.login(user, password);At this point, you can use all the Activity methods from the “activity” class as shown below:
ActivityList results = ws.activity.findActivityLog(0, 20, beginDate, endDate, user, "", item);Methods
Section titled “Methods”findActivityLog
Section titled “findActivityLog”Description:
| Method | Return values | Description |
|---|---|---|
| findActivityLog(int page, int length, DateTime beginDate, DateTime endDate, String user, String action, String item, String hostname) | ActivityList | Returns a list of all activity logs by date, user, action, and item. |
The value of the item is the UUID of the node (document, folder, mail, or record).
The value of the hostname is the host from which the activity was originated. An empty string returns activities from all hosts.
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:8180/openkm"; String username = "okmAdmin"; String password = "admin"; OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try { ws.login(user, password); DateTime beginDate = new DateTime(2019, 7, 1); DateTime endDate = new DateTime(2019, 8, 1); String hostname = ""; ActivityList activityList = ws.activity.findActivityLog(0, 10, beginDate, endDate, "testUser", "LOGIN", null, hostname); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getActivityActions
Section titled “getActivityActions”Description:
| Method | Return values | Description |
|---|---|---|
| getActivityActions() | List |
Returns a list of all activity log actions. |
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:8180/openkm"; String username = "okmAdmin"; String password = "admin"; OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try { ws.login(user, password); List<string> actions = ws.activity.getActivityActions(); foreach(string action in actions) { System.Console.WriteLine(action); } } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}