Page 1 of 1

Restsharp missing method exception

PostPosted:Fri Dec 25, 2015 9:37 pm
by snowman
Hello,

I try to add a file using the OpenKM C# Rest API 2.1.
I just set up a project in VS2013, found out that I had to add RestSharp (v105.2.3.0 by NuGet) and now get a "Missing method" exception on calling createDocument():
Code: Select all
An unhandled exception of type 'System.MissingMethodException' occurred in OKMRest.dll
Additional information: Method not found: "RestSharp.IRestRequest RestSharp.IRestRequest.AddFile(System.String, Byte[], System.String)".
Is this library actively maintained?
Are there any tutorials or examples on the API?
Is there documentation of the methods and there usage?

My code is:
Code: Select all
class Program
    {
        static void Main(string[] args)
        {
            String host = "http://10.10.7.11:8080/OpenKM";
            String user = "okmAdmin";
            String password = "admin";
            var okm=OKMWebservicesFactory.newInstance(host, user, password);
            using (var fileStream = new FileStream(@"testmail.eml", FileMode.Open, FileAccess.Read))
            {
                okm.createDocument("/test/testmail.eml", fileStream);
            }
        }
    }
Best regards,
Snowman

Re: Restsharp missing method exception

PostPosted:Sun Dec 27, 2015 10:29 am
by jllort
If you are user of community version you should take a look here http://docs.openkm.com/kcenter/view/sdk4net-1.1.1/
And yes, the sdk libraries are actively maintained ( corrections and upgrades ). You have a changelog here http://docs.openkm.com/kcenter/view/sdk4net/

You should downgrade the RestSharp.dll library, read http://docs.openkm.com/kcenter/view/sdk ... ments.html we have still not upgraded to version 105 ( seems from version 104 to 105 the library has been changed enought to do not be full compatible - without changes - from previous version ). We do not like to be following the library changes each time it happens, our strategy is do this kind of updates one time per year, we prefer a controlled version what we know is going right for us, and one time per year upgrade to latest library version and then check again. We think this strategy introduces less bugs than be updated each time a library decides to releasing a new version.

Re: Restsharp missing method exception

PostPosted:Mon Dec 28, 2015 7:58 am
by snowman
Hello,

thank you. It works now, I understand that only v1.1.1 is available for the community edition?
I hoped to find a way to get a .eml file imported as mail into the file area.
It looks like createDocumentSimple() behaves differently than the manual file import in the web client. I have not found a method to import a mail.
Unfortunately, I am not proficient with Java so I want to find a way to automatically mirror my imap sever with its directory structure into openkm.

Best

Re: Restsharp missing method exception

PostPosted:Tue Dec 29, 2015 4:30 pm
by jllort
This week we have added a method in rest service ( also in community ) for importing eml and msg files ( what are converted as mails into openkm ). That was needed because we are changing MS Office Addin ( from soap to rest ). We still have not officially released it, probably will be during the next January.