Import samples
We suggest executing the methods below for huge import or for simple creation cases.
These methods execute fewer steps in the background either what is described in Document samples and Folder samples. That means you will get extra performance in the action because there are executed less logic in the server side.
Basic
Example of uuid:
- Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
Methods
importDocument
Description:
Method | Return values | Description |
---|---|---|
importDocument(String uuid, FileInfo fi) |
String |
Creates a new document and return the UUID of the Document. |
The values of the uuid parameter should be a folder or record node UUID. |
Example:
using System; using System.Collections.Generic;
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);
FileInfo fileInfo = new FileInfo("E:\\doc.docx");
String uuid = ws.importDocument("22c1d190-f798-489d-b420-2008cb38705b", fileInfo);
System.Console.WriteLine("UUID ="+ uuid);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
importFolder
Description:
Method | Return values | Description |
---|---|---|
importFolder(String uuid, String name) |
String |
Creates a new folder and return the UUID of the folder. |
The values of the uuid parameter should be a folder or record node UUID. |
Example:
using System; using System.Collections.Generic;
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 uuid = ws.importFolder("22c1d190-f798-489d-b420-2008cb38705b", "Folder-Name");
System.Console.WriteLine("UUID ="+ uuid);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}