using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query; /// <summary>
/// 知识库文章
/// </summary>
public class KbArticleHelper
{
public static readonly string entityName = "kbarticle";
public Guid kbArticleId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建知识库文章
/// </summary>
public void Create()
{
Entity en = new Entity() { LogicalName = entityName };
en["title"] = "知识库文章测试";
kbArticleId = service.Create(en);
} /// <summary>
/// 检索指定的产品的前十篇知识库文章
/// </summary>
/// <param name="productId">产品id</param>
public void RetrieveByTopIncidentProductKbArticle(Guid productId)
{
RetrieveByTopIncidentProductKbArticleRequest request = new RetrieveByTopIncidentProductKbArticleRequest();
request.ProductId = productId;
RetrieveByTopIncidentProductKbArticleResponse response =
(RetrieveByTopIncidentProductKbArticleResponse)service.Execute(request);
EntityCollection entityCollection = response.EntityCollection;
} /// <summary>
/// 检索指定的主题的前十篇知识库文章
/// </summary>
/// <param name="subjectId">主题id</param>
public void RetrieveByTopIncidentSubjectKbArticle(Guid subjectId)
{
RetrieveByTopIncidentSubjectKbArticleRequest request = new RetrieveByTopIncidentSubjectKbArticleRequest();
request.SubjectId = subjectId;
RetrieveByTopIncidentSubjectKbArticleResponse response =
(RetrieveByTopIncidentSubjectKbArticleResponse)service.Execute(request);
EntityCollection entityCollection = response.EntityCollection;
} /// <summary>
/// 查找正文中包含指定文本的所有文档索引
/// </summary>
/// <param name="query">查询条件</param>
/// <param name="text">指定文本</param>
/// <param name="subjectId">主题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 entityCollection = response.EntityCollection;
} /// <summary>
/// 查找包含指定关键字的所有文档索引
/// </summary>
/// <param name="query">查询条件</param>
/// <param name="text">指定文本</param>
/// <param name="subjectId">主题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 entityCollection = response.EntityCollection;
} /// <summary>
/// 查找标题中包含指定文本的所有文档索引
/// </summary>
/// <param name="query">查询条件</param>
/// <param name="text">指定文本</param>
/// <param name="subjectId">主题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 entityCollection = response.EntityCollection;
} /// <summary> ///
/// 删除知识库文章 ///
/// </summary>
public void Delete() { service.Delete(entityName, kbArticleId); }
}

Kb Article Helper的更多相关文章

  1. Dynamics CRM 2011-RootComponent Type

    笔者因为时不时要导出solution,对solution xml进行处理,所以把xml中的rootcomponent type列一下  Type Description 1 Entity 2 Attr ...

  2. 删除流氓软件McAfee

    如何解决卸载McAfee时出现"处于托管模式时无法删除"问题 问题现象: 这几天在为客户终端换装杀毒软件时出现这么一个问题:在控制面板的添加或删除程序里面将"McAfee ...

  3. 非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛

    非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛 Glenn Berry 大牛会对这个脚本持续更新 -- SQL Server 2012 Diagnost ...

  4. 企业IT管理员IE11升级指南【4】—— IE企业模式介绍

    企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...

  5. Visual Studio 2013 Update 3 RTM 正式发布

    VS2013.3 RTM已发布! 完整安装包:http://download.microsoft.com/download/6/F/0/6F0777D3-3541-465F-8639-A8F9D36B ...

  6. Ignite安装配置——上篇

    Ignite介绍 Ignite 是SolarWinds公司开发的一款数据库性能监控.性能分析并提供优化解决方案的性能检测分析工具,Ignite配置简单.方便:它会收集实时会话数据.服务器资源使用情况, ...

  7. Ignite 配置更新Oracle JDBC Drive

           如果使用Oracle 12C 作为Ignite 的Repository的话,在Repository Createion Wizard的配置过程中,会出现ORA-28040:No matc ...

  8. SQL Server 2008 R2 升级到 Service Pack 3后Report Builder启动不了

    一同事将测试服务器从SQL Server 2008 R2 SP2升级到了SQL Server 2008 R2 SP3后发现Report Service的报表编辑时启动不了Report Builder, ...

  9. ASP.NET corrupt assembly “Could not load file or assembly App_Web_*

    以下是从overFlow 复制过来的问题 I've read through many of the other questions posted on the same issue, but I s ...

随机推荐

  1. PyCharm2018 安装及破解方法

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u012278016/article/details/81738676 目录 1>. 安装 2& ...

  2. PL/SQL编程基础——PL/SQL简介

    课程教师:李兴华 课程学习者:阳光罗诺 日期:2018-07-28 知识点: 1. 了解PL/SQL的主要特点 2. 掌握PL/SQL块的基本结构 PL/SQL PL/SQL是Oracle在关系数据库 ...

  3. Angular5中提取公共组件之radio list

    上一篇说到了Checkbox List的公共组件提取,现在说一下Radio List的公共组件提取. Radio List组件提取起来很方便,不想Checkbox那么复杂. radio-list.co ...

  4. 关于Angular中时间戳的计算

    前言 使用的是Moment.js 插件,插件的安装详情请参考官方网址(https://momentjs.com/) 正文 步骤一:引用import * as moment from 'moment'; ...

  5. Django路由系统---django重点之url命名分组

    django重点之url命名分组[参数无顺序要求]. settigs.py:增加STATICFILES_DIRS静态资源路径配置,名称为创建的文件夹名称 'DIRS': [os.path.join(B ...

  6. 沉淀再出发:java中注解的本质和使用

    沉淀再出发:java中注解的本质和使用 一.前言 以前XML是各大框架的青睐者,它以松耦合的方式完成了框架中几乎所有的配置,但是随着项目越来越庞大,XML的内容也越来越复杂,维护成本变高.于是就有人提 ...

  7. Spark 2.x 中 Sort-Based Shuffle 产生的内幕

    本课主题 Sorted-Based Shuffle 的诞生和介绍 Shuffle 中六大令人费解的问题 Sorted-Based Shuffle 的排序和源码鉴赏 Shuffle 在运行时的内存管理 ...

  8. 一次失败的尝试hdfs的java客户端编写(在linux下使用eclipse)

    一次失败的尝试hdfs的java客户端编写(在linux下使用eclipse) 给centOS安装图形界面 GNOME桌面环境 https://blog.csdn.net/wh211212/artic ...

  9. [T-ARA][지난 달력][旧挂历]

    歌词来源:http://music.163.com/#/song?id=29343994 作曲 : Rocoberry [作曲 : Rocoberry] [作曲 : Rocoberry] 作词 : R ...

  10. 利用Fiddler2和Proxifier分析你用的中国菜刀是否带有后门

    为了避免自己辛辛苦苦拿下的站点被一些拿来主义者不费吹灰之力就据为己有,下面来教大家如何检测菜刀有没有留后门. 对于有没有后门这个问题,大牛们会说抓包看一下就行了,那如何抓包呢?有很多软件可以,这里使用 ...