Ir al contenido
Otras versiones

Cargando…

PropertyGroup samples

Esta página aún no está disponible en tu idioma.

On almost methods, you’ll see the parameter named “nodeId”. The value of this parameter can be a valid document, folder, mail or record UUID or path.

Description:

Method Return values Description
addGroup(String nodeId, String grpName) void Adds an empty metadata group to a node.
  • The grpName should be a valid Metadata group name.

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, username, password);
try
{
ws.addGroup("/okm:root/logo.png", "okg:consulting");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
removeGroup(String nodeId, String grpName) void Removes a metadata group of a node.
  • The grpName should be a valid Metadata group name.

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, username, password);
try
{
ws.removeGroup("/okm:root/logo.png", "okg:consulting");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getGroups(String nodeId) List Retrieves a list of metadata groups assigned 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, username, password);
try
{
foreach (PropertyGroup pGroup in ws.getGroups("/okm:root/logo.png"))
{
System.Console.WriteLine(pGroup);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getAllGroups() List Retrieves a list of all metadata groups set into the application.

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, username, password);
try
{
foreach (PropertyGroup pGroup in ws.getAllGroups())
{
System.Console.WriteLine(pGroup);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getPropertyGroupProperties(String nodeId, String grpName) List Retrieves a list of all metadata group elements and its values of a node.
  • The grpName should be a valid Metadata group name.

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.bean.form;
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, username, password);
try
{
foreach(FormElement fElement in ws.getPropertyGroupProperties("/okm:root/logo.png", "okg:consulting"))
{
System.Console.WriteLine(fElement);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getPropertyGroupForm(String grpName) List Retrieves a list of all metadata group elements definition.
  • The grpName should be a valid Metadata group name.

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.bean.form;
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, username, password);
try
{
foreach (FormElement fElement in ws.getPropertyGroupForm("okg:consulting"))
{
System.Console.WriteLine(fElement);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
setPropertyGroupProperties(String nodeId, String grpName, List ofeList) void Change the metadata group values of a node.
  • The grpName should be a valid Metadata group name.

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.util;
using com.openkm.sdk4csharp.bean.form;
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, username, password);
try
{
// Modify with a full FormElement list
List<FormElement> fElements = ws.getPropertyGroupProperties("/okm:root/logo.pdf","okg:consulting");
foreach (FormElement fElement in fElements)
{
if (fElement.name.Equals("okp:consulting.name"))
{
Input name = (Input) fElement;
name.value = "new value";
}
}
ws.setPropertyGroupProperties("/okm:root/logo.pdf","okg:consulting", fElements);
// Same modification with only affected FormElement
fElements = new List<FormElement>();
Input n = new Input();
n.name = "okp:consulting.name";
n.value = "new value";
fElements.Add(n);
ws.setPropertyGroupProperties("/okm:root/logo.pdf","okg:consulting", fElements);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
setPropertyGroupPropertiesSimple(String nodeId, String grpName, Dictionary<String, String> properties) void Changes the metadata group values of a node.
  • The grpName should be a valid Metadata group name.

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.util;
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, username, password);
try
{
Dictionary<String, String> properties = new Dictionary<String, String>();
properties.Add("okp:consulting.name", "new name");
//The date fields must be saved with basic ISO 8601 format
properties.Add("okp:consulting.date", ISO8601.formatBasic(DateTime.Now));
ws.setPropertyGroupPropertiesSimple("/okm:root/logo.pdf","okg:consulting", properties);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
hasGroup(String nodeId, String grpName) Boolean Returns a boolean that indicates if the node has or not a metadata group.

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, username, password);
try
{
System.Console.WriteLine("Have metadata group:"+ws.hasGroup("/okm:root/logo.png","okg:consulting"));
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getRegisteredDefinition() String Return the XML Metada groups definition.

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, username, password);
try
{
System.Console.WriteLine(ws.getRegisteredDefinition());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
registerDefinition(InputStream is) void Sets the XML Metadata groups definition into the repository..

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using System.IO;
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, username, password);
try
{
FileStream fs = new FileStream("E:\\PropertyGroups.xml",FileMode.Open);
ws.registerDefinition(fs);
fs.Dispose();
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getSuggestions(String nodeId, String grpName, String propName) List Retrieves a list of a suggested metadata field values.

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, username, password);
try
{
foreach(String value in ws.getSuggestions("/okm:root/logo.png","okg:technology", "okp:technology.language"))
{
System.Console.WriteLine(value);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getPropertyGroupPropertiesSimple(String nodeId, String grpName) Dictionary<String, String> Retrieves a dictionary- (key,value) pairs - with Metada group values of 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, username, password);
try
{
Dictionary<String, String> properties = new Dictionary<String, String>();
properties = ws.getPropertyGroupPropertiesSimple("/okm:root/logo.pdf","okg:technology");
foreach (KeyValuePair<String, String> pair in properties)
{
System.Console.WriteLine(pair.Key + "-> " + pair.Value);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}