web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Publish KnowledgeArticle via the Web API

(0) ShareShare
ReportReport
Posted on by

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)
  • Suggested answer
    ThomasN Profile Picture
    3,190 on at
    RE: Publish KnowledgeArticle via the Web API

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans