abrudtkuhl / WordPressSharp

A C# client to to interact with the WordPress XML-RPC API
abrudtkuhl.github.io/WordPressSharp/
GNU General Public License v3.0
103 stars 49 forks source link

How Can I Get the Post Name for Link ? #87

Open GlennIM opened 6 years ago

GlennIM commented 6 years ago

I need it to return the Post Name permalink format not the Plain format. How can I convert this to the Post name format ?

I checked the blog I created a post on and the Pernalink settings are set to "Post Name".

string postID = client.NewPost(post); Post thepost = client.GetPost(Convert.ToInt32(postID)); // returns "http://mysite.com/?p=6175"

kombasltd commented 6 years ago

Did you create your post in draft mode?

GlennIM commented 6 years ago

Yes... creating in "Draft Mode"

If I create it in Publish mode, will it return the post name format?

Also, before I publish a post, can you tell me how to check to see if it already exists already? I don't want to post duplicate content. Can you show me a code snippet I would use to check for an existing post?

Thanks Again, Glenn