• 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);
            }
        }

  • 相关阅读:
    Scrum框架及其背后的原则(上)——Scrum 框架的伪代码描述[转载自InfoQ]
    用程序给闺女出算数题——我的头脑体操
    敏捷实践调查结果[翻译转载]
    一.初识Selenium
    二.Selenium安装相关文件
    Review of American Beauty(unoriginal)
    三.Selenium IDE学习
    将Java Project转变为Dynamic Web Project
    功能自动化工具watiJ(转载)
    Selenium前奏
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5222543.html
Copyright © 2020-2023  润新知