UserConfig samples
Basics
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 Activity methods from "userConfig" class as is shown below:
ws.userConfig.getConfig();
Methods
getConfig
Description:
Method | Return values | Description |
---|---|---|
getConfig() |
UserConfig |
Returns the user settings. |
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);
UserConfig userCfg = ws.userConfig.getConfig();
Console.WriteLine("User: " + userCfg.user);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setHome
Description:
Method | Return values | Description |
---|---|---|
setHome(String uuid) |
void |
Set the user home node. |
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);
ws.userConfig.setHome("53751cb7-c462-4320-ba46-4cc33e4667ae");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}