Hi,
What is the process to publish a KnowledgeArticle via the Web API? I have been able to successfully post a KnowledgeArticle in draft state, but need to move it to Published state. Here is my code to publish in draft state in C#
JObject jObject = new JObject(); jObject["content"] = kba.Content; jObject["title"] = kba.Title; jObject["createdon"] = DateTime.Now; jObject["modifiedon"] = DateTime.Now; jObject["knowledgearticleviews_date"] = DateTime.Now; jObject["rating_date"] = DateTime.Now; jObject["knowledgearticleid"] = Guid.NewGuid().ToString(); jObject["description"] = kba.Description; var client = new RestClient(Settings.DynamicsApiUrl + "/knowledgearticles"); var request = new RestRequest(Method.POST); request.AddParameter("authorization", string.Format("Bearer " + _authToken), ParameterType.HttpHeader); request.AddParameter("application/json", jObject.ToString(), ParameterType.RequestBody); request.RequestFormat = DataFormat.Json; request.AddBody(jObject.ToString()); IRestResponse response = client.Execute(request); if (!response.IsSuccessful) throw new Exception(response.Content);
*This post is locked for comments
I have the same question (0)Hi Hpop, thanks for reaching out.
Not sure what you have already tried, but this should be simple as adding the attributes statecode, and statuscode both equal to publish. Here is link to API, but verify your metadata matches. docs.microsoft.com/.../knowledgearticle
Also there is a field publishstatusid which might be required. Hope this helps.
Aric Levin - MVP
2
Moderator
MA-04060624-0
1