WordPressSharp icon indicating copy to clipboard operation
WordPressSharp copied to clipboard

client.GetPost() Method Throwing Exception

Open GlennIM opened this issue 6 years ago • 2 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);

GlennIM avatar Aug 29 '18 16:08 GlennIM

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

Blackcat156 avatar Oct 28 '18 14:10 Blackcat156