CRM Operation Knowledge Base Article entity

Source: Internet
Author: User

Using system;
Using Microsoft. xrm. SDK;
Using Microsoft. CRM. SDK. messages;
Using Microsoft. xrm. SDK. query;

/// <Summary>
/// Knowledge Base Article
/// </Summary>
Public class kbarticlehelper
{
Public static readonly string entityname = "kbarticle ";
Public guid kbarticleid = guid. empty;
Public iorganizationservice service;

/// <Summary>
/// Create a Knowledge Base Article
/// </Summary>
Public void create ()
{
Entity en = new entity () {logicalname = entityname };
En ["title"] = "Knowledge Base Article test ";
Kbarticleid = service. Create (en );
}

/// <Summary>
/// Retrieve the top 10 Knowledge Base articles of a specified product
/// </Summary>
/// <Param name = "productid"> product ID </param>
Public void retrievebytopincidentproductkbarticle (guid productid)
{
Retrievebytopincidentproductkbarticlerequest request = new retrievebytopincidentproductkbarticlerequest ();
Request. productid = productid;
Retrievebytopincidentproductkbarticleresponse response =
(Retrievebytopincidentproductkbarticleresponse) service. Execute (request );
Entitycollection = response. entitycollection;
}

/// <Summary>
/// Retrieve the first 10 articles in the knowledge base on the specified topic
/// </Summary>
/// <Param name = "subjectid"> topic id </param>
Public void retrievebytopincidentsubjectkbarticle (guid subjectid)
{
Retrievebytopincidentsubjectkbarticlerequest request = new retrievebytopincidentsubjectkbarticlerequest ();
Request. subjectid = subjectid;
Retrievebytopincidentsubjectkbarticleresponse response =
(Retrievebytopincidentsubjectkbarticleresponse) service. Execute (request );
Entitycollection = response. entitycollection;
}

/// <Summary>
/// Search for all document indexes that contain the specified text in the body
/// </Summary>
/// <Param name = "query"> query condition </param>
/// <Param name = "text"> specify text </param>
/// <Param name = "subjectid"> topic id </param>
Public void searchbybodykbarticle (querybase query, string text, guid subjectid)
{
Searchbybodykbarticlerequest request = new searchbybodykbarticlerequest ();
Request. queryexpression = query;
Request. useinflection = true;
Request. searchtext = text;
Request. subjectid = subjectid;
Searchbybodykbarticleresponse response = (searchbybodykbarticleresponse) service. Execute (request );
Entitycollection = response. entitycollection;
}

/// <Summary>
/// Search for all document indexes containing the specified keyword
/// </Summary>
/// <Param name = "query"> query condition </param>
/// <Param name = "text"> specify text </param>
/// <Param name = "subjectid"> topic id </param>
Public void searchbykeywordskbarticle (querybase query, string text, guid subjectid)
{
Searchbykeywordskbarticlerequest request = new searchbykeywordskbarticlerequest ();
Request. queryexpression = query;
Request. useinflection = true;
Request. searchtext = text;
Request. subjectid = subjectid;
Searchbykeywordskbarticleresponse response = (searchbykeywordskbarticleresponse) service. Execute (request );
Entitycollection = response. entitycollection;
}

/// <Summary>
/// Search for all document indexes whose titles contain the specified text
/// </Summary>
/// <Param name = "query"> query condition </param>
/// <Param name = "text"> specify text </param>
/// <Param name = "subjectid"> topic id </param>
Public void searchbytitlekbarticle (querybase query, string text, guid subjectid)
{
Searchbytitlekbarticlerequest request = new searchbytitlekbarticlerequest ();
Request. queryexpression = query;
Request. useinflection = true;
Request. searchtext = text;
Request. subjectid = subjectid;
Searchbytitlekbarticleresponse response = (searchbytitlekbarticleresponse) service. Execute (request );
Entitycollection = response. entitycollection;
}

/// <Summary>
/// Delete a Knowledge Base Article
/// </Summary>
Public void Delete ()
{
Service. Delete (entityname, kbarticleid );
}
}

CRM Operation Knowledge Base Article entity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.