Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Find Out if Published Post Already Exists ? #92

Open
GlennIM opened this issue Aug 10, 2018 · 1 comment
Open

How to Find Out if Published Post Already Exists ? #92

GlennIM opened this issue Aug 10, 2018 · 1 comment

Comments

@GlennIM
Copy link

GlennIM commented Aug 10, 2018

Before I publish a post I need to know if the post already exists. I know what the title of the post is but I need a way to search the blog for an existing post using the title I already know.

I tried calling the method GetPosts() as shown below but it throws an exception. What can I do to get a list of published posts so that I can search the list. If the list contains the post I need to get the post URL.
In the code below, I changed PostStatus to "draft" and the code worked but only returned 10 draft posts and the blog has over 600.

var posts = client.GetPosts(new PostFilter { PostType = "post", PostStatus = "publish" }).OrderByDescending(a => a.Id).ToList();

I changed my code to pass null to the PostFilter as shown below but get the following unhandled exception.

var posts = client.GetPosts(null);

Both lines of code above return the same exception below...

CookComputing.XmlRpc.XmlRpcInvalidXmlRpcException

"response contains invalid dateTime value [response : array mapped to type Post[] : element 2 : struct mapped to type Post : member FeaturedImage mapped to type Object : struct mapped to XmlRpcStruct : member date_created_gmt : dateTime]"

Please Help!
Thanks, Glenn

@Blackcat156
Copy link

You can write a spider and search it directly on Web pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants