Kb Article Helper
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的更多相关文章
- Dynamics CRM 2011-RootComponent Type
笔者因为时不时要导出solution,对solution xml进行处理,所以把xml中的rootcomponent type列一下 Type Description 1 Entity 2 Attr ...
- 删除流氓软件McAfee
如何解决卸载McAfee时出现"处于托管模式时无法删除"问题 问题现象: 这几天在为客户终端换装杀毒软件时出现这么一个问题:在控制面板的添加或删除程序里面将"McAfee ...
- 非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛
非常全面的SQL Server巡检脚本来自sqlskills团队的Glenn Berry 大牛 Glenn Berry 大牛会对这个脚本持续更新 -- SQL Server 2012 Diagnost ...
- 企业IT管理员IE11升级指南【4】—— IE企业模式介绍
企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...
- Visual Studio 2013 Update 3 RTM 正式发布
VS2013.3 RTM已发布! 完整安装包:http://download.microsoft.com/download/6/F/0/6F0777D3-3541-465F-8639-A8F9D36B ...
- Ignite安装配置——上篇
Ignite介绍 Ignite 是SolarWinds公司开发的一款数据库性能监控.性能分析并提供优化解决方案的性能检测分析工具,Ignite配置简单.方便:它会收集实时会话数据.服务器资源使用情况, ...
- Ignite 配置更新Oracle JDBC Drive
如果使用Oracle 12C 作为Ignite 的Repository的话,在Repository Createion Wizard的配置过程中,会出现ORA-28040:No matc ...
- SQL Server 2008 R2 升级到 Service Pack 3后Report Builder启动不了
一同事将测试服务器从SQL Server 2008 R2 SP2升级到了SQL Server 2008 R2 SP3后发现Report Service的报表编辑时启动不了Report Builder, ...
- 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 ...
随机推荐
- 深圳云栖大会人工智能专场:探索视频+AI,玩转智能视频应用
摘要: 在人工智能时代,AI技术是如何在各行业和领域真正的发挥应用和商业价值,带来产业变革才是关键.在3月28日深圳云栖大会的人工智能专场中,阿里云视频服务技术专家邹娟将带领大家探索熟悉的视频场景中, ...
- 乘风破浪:LeetCode真题_012_Integer to Roman
乘风破浪:LeetCode真题_012_Integer to Roman 一.前言 经过了前面的思维训练,我们在某些方面有了一定的提高,但是对于实际的问题,要在短时间内得到答案,还是需要我们多多的练习 ...
- 一点二次插值、二点二次插值 ,matlab
syms f x a b c; f(x)=3*x^4-4*x^3-12*x^2; q(x)=a*x^2+b*x+c; %二点二次插值 x=[-1.2 -0.8]; ff=diff(diff(f)); ...
- 使用普通用户set autotrace on报错SP2-0618: Cannot find the Session Identifier
普通用户使用 autotrace,出现如下报错: SQL> set autotrace on SP2-0618: Cannot find the Session Identifier. Che ...
- Docker简介与搭建
Docker定义 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相 ...
- Linux基础入门 - 3
第四节 Linux 目录结构及文件基本操作 4-1.Linux目录结构 Linux 的目录与 Windows 的目录的实现机制是完全不同的.一种不同是体现在目录与存储介质(磁盘,内存,DVD 等)的关 ...
- 修复xcode6.2 插件不能使用问题
在终端输入以下命令即可: find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -m ...
- 【转】用instruments来检验你的app
一篇非常好的关于instruments使用的文章! 连接在此
- 3、Python文件操作工具 xlwt 工具
# _*_ encoding:utf-8 _*_ import xlrdimport xlwt #新建excel文件excel = xlwt.Workbook(encoding='utf-8')#添加 ...
- Webpack知识汇总
介绍 webpack把任何一个文件都看成是一个模块,模块间可以相互依赖(require or import),webpack的功能就是把相互依赖的文件打包在一起.webpack本身只能处理原生的Jav ...