Skip to content

UserConfig samples

First, you must create the web service object:

OKMWebservices ws = OKMWebservicesFactory.newInstance(host);

Then you should log in using the method “login”. 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 “userConfig” class as shown below:

Terminal window
ws.userConfig.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());
}
}
}
}

Description:

Method Return values Description
setHome(String uuid) void Sets the user’s 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());
}
}
}
}