abrudtkuhl / WordPressSharp

A C# client to to interact with the WordPress XML-RPC API

Home Page:abrudtkuhl.github.io/WordPressSharp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

client.GetPost() Method Throwing Exception

GlennIM opened this issue · comments

I have the plugin called "Featured Image from URL" installed and set to use the 1'st image in the post when and post is published and I am getting the following exception when calling the GetPost() function below. When I disable the "Featured Image from URL" no exception is thrown.

Post thepost = client.GetPost(Convert.ToInt32(postID));

Here is the exception...

{"response contains invalid dateTime value [response : struct mapped to type Post : member FeaturedImage mapped to type Object : struct mapped to XmlRpcStruct : member date_created_gmt : dateTime]"}

What can I do to make sure the call to GetPost() function works withour throwing the exception and have the "Featured Image from URL" plugin active?


Also,
I tried the following .CreateFromUrl() function shown below to create the Featured Image inside my function and want to know if the "url" needs to be an web url like "http://mydomain.com/wp-content/uploads/images/articles/vegan_recipes/img.jpg" or can it be from my local PC path like this...
"D:\Webs\MyWebsite.com\images\vegan_recipes\207236020333882044.jpg"

I tried calling CreateFromUrl() using a local file path but doesn't set the Featured Image. Is there a workaround?

var featureImage = Data.CreateFromUrl(url);

Set Featured images
Post.FeaturedImageId =wordPressClient.UploadFile(Data.CreateFromUrl("ImgLink")).Id;