Restsharp missing method exception

Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
snowman
Junior Boarder
Junior Boarder
Posts: 26
Joined: Mon Feb 21, 2011 8:32 pm

Restsharp missing method exception

Post by snowman » Fri Dec 25, 2015 9:37 pm

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

jllort
Moderator
Moderator
Posts: 9117
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Restsharp missing method exception

Post by jllort » Sun Dec 27, 2015 10:29 am

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.

snowman
Junior Boarder
Junior Boarder
Posts: 26
Joined: Mon Feb 21, 2011 8:32 pm

Re: Restsharp missing method exception

Post by snowman » Mon Dec 28, 2015 7:58 am

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

jllort
Moderator
Moderator
Posts: 9117
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Restsharp missing method exception

Post by jllort » Tue Dec 29, 2015 4:30 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest