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. c#多线程调用有参数的方法

      Thread (ParameterizedThreadStart) 初始化 Thread 类的新实例,指定允许对象在线程启动时传递给线程的委托.   Thread (ThreadStart) 初始 ...

  2. 关于hashcode 里面 使用31 系数的问题

    首先我们来了解一下hashcode,什么是hashcode?有什么作用? hashcode其实就是散列码,使用hashcode使用高效率的哈希算法来定位查找对象! 我们在使用容器来存储数据的时候会计算 ...

  3. python之内置函数,匿名函数

    什么是内置函数? 就是Python给你提供的,拿来直接用的函数,比如print,input等等.其实就是我们在创建.py的时候python解释器所自动生成的内置的函数,就好比我们之前所学的作用空间 内 ...

  4. 使用iCarousel的旋转木马效果请求图片

    使用iCarousel的旋转木马效果请求图片 https://github.com/nicklockwood/iCarousel 先看看效果: 源码如下: // // RootViewControll ...

  5. [翻译] MGConferenceDatePicker

    MGConferenceDatePicker https://github.com/matteogobbi/MGConferenceDatePicker MGConferenceDatePicker ...

  6. Linux入门-4 Linux下获取帮助

    help MAN INFO doc help <command> -h或<command> --help whatis <cmd> MAN man <comm ...

  7. Django路由系统---django重点之url映射分发

    django重点之url映射分发 在全局项目的urls.py中进行子项目的映射,然后在子项目中创建一个urls.py去处理自己项目中的请求,同时也实现了代码的解耦 添加路由分发的原则[全局urls.p ...

  8. Java学习---IO操作

    基础知识 1.文件操作 Java语言统一将每个文件都视为一个顺序字节流.每个文件或者结束于一个文件结束标志,或者根据系统维护管理数据中所纪录的具体字节数来终止.当一个文件打开时,一个对象就被创建,同时 ...

  9. 第六次作业——Excel制作工资表

  10. 使用ESP8266连接到Azure

    很多同学在问我,ESP8266如何连接到Azure,因为官方只有Spark Fun之类的DevKit(开发套件)出了教程(我只找到了套件的文档). 先上视频:http://v.youku.com/v_ ...