zoukankan      html  css  js  c++  java
  • crm操作知识库文章实体

        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>
            /// 查找包括指定keyword的全部文档索引
            /// </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);
            }
        }

  • 相关阅读:
    oracle数据库使用sys_guid()返回乱码问题
    weblogic 环境改变后,重启应用后方法,报错java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance
    ORACLE数据库误删表后,没重新建表场景下数据恢复
    Linux环境下weblogic12开启远程debug端口
    关于HOSTS设置不生效的解决小方法
    dubbo调用 Caused by: com.alibaba.dubbo.remoting.RemotingException 异常解决方法
    textkit 研究,mark一下,一个不错的开源库:MLLabel(但是没有文档)
    swift流行UI库(github)
    Android高级第十一讲之不同系统间的区别
    欢快的使用Unity JSON吧
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5222543.html
Copyright © 2011-2022 走看看