I didn't find any client.Questions.Add
method.
So, how do I use the StacMan library to add a new question ?
Any sample C# example?
I didn't find any client.Questions.Add
method.
So, how do I use the StacMan library to add a new question ?
Any sample C# example?
As Brock Adams stated in his answer, you can't do this via the StacMan library.
Might I suggest an alternative?
You should be able to add new questions via the SEStandard library at SEStandard - A .NET Standard 1.1 compliant Stack Exchange client library that supports API v2.2.
using System.Threading.Tasks;
using RavinduL.SEStandard;
using Scopes = RavinduL.SEStandard.Models.Scopes;
var client = new StackExchangeClient
(
clientId: ...,
key: ...,
// The WriteAccess scope and an access token are required to add questions to Stack Exchange.
scopes: Scopes.WriteAccess,
accessToken: ...
);
var query = await client.Questions.AddAsync
(
title: ...,
body: ...,
tags: new string[] { ... },
site: ...,
// To preview the effects of adding instead of actually adding the question to Stack Exchange,
preview: true
);
The variable query
would be a Wrapper<Question>
object. query.Items[0]
would be the question that was just added (a Question
object).
More documentation is available at the Stack Apps link above, and at the GitHub Repository.
Obligatory: I developed the SEStandard library.
StackExchangeClient
object, and handle redirection from it. I’ve documented the process, with an example, here.
Commented
Mar 1, 2018 at 15:58
You can't.
StacMan hasn't been updated since September 2014, and only supports the API through version 2.1.
The API didn't have a /questions/add
route until version 2.2.