• crm操作约会实体


        using System;
        using Microsoft.Xrm.Sdk;
        using Microsoft.Crm.Sdk.Messages;
        using Microsoft.Xrm.Sdk.Query;

        /// <summary>
        /// 约会
        /// </summary>
        public class AppointmentHelper
        {
            public static readonly string entityName = "appointment";
            public Guid appointmentId = Guid.Empty;
            public IOrganizationService service;

            /// <summary>
            /// 创建约会
            /// </summary>
            public void Create()
            {
                WhoAmIRequest userRequest = new WhoAmIRequest();
                WhoAmIResponse userResponse = (WhoAmIResponse)service.Execute(userRequest);
                Entity activitypartyEn = new Entity(){ LogicalName = "activityparty" };
                activitypartyEn["partyId"] = new EntityReference(){ LogicalName = "systemuser",Id = userResponse.UserId };

                Entity en = new Entity() { LogicalName = entityName };
                en["subject"] = "约会測试";
                en["scheduledstart"] = DateTime.Now.AddHours(1);
                en["scheduledend"] = DateTime.Now.AddHours(2);
                en["location"] = "办公室";
                en["requiredattendees"] = new Entity[] { activitypartyEn };
                en["organizer"] = new Entity[] { activitypartyEn };
                appointmentId = service.Create(en);
            }

            /// <summary>
            /// 向现有约会中加入定期信息,以使其成为定期主约会
            /// </summary>
            /// <param name="target">目标信息</param>
            public void AddRecurrence(Entity target)
            {
                AddRecurrenceRequest request = new AddRecurrenceRequest();
                request.AppointmentId = appointmentId;
                request.Target = target;
                AddRecurrenceResponse response = (AddRecurrenceResponse)service.Execute(request);
                Guid id = response.id;
            }

            /// <summary>
            /// 将约会分派给其它用户或团队
            /// </summary>
            /// <param name="assignee">用户或团队引用</param>
            public void Assign(EntityReference assignee)
            {
                AssignRequest request = new AssignRequest();
                request.Target = new EntityReference() { LogicalName = entityName,Id = appointmentId };
                request.Assignee = assignee;
                AssignResponse response = (AssignResponse)service.Execute(request);
            }

            /// <summary>
            /// 安排或预定约会
            /// </summary>
            public void Book()
            {
                BookRequest request = new BookRequest();
                request.Target = new Entity() { LogicalName = entityName,Id = appointmentId };
                BookResponse response = (BookResponse)service.Execute(request);
                ValidationResult validationResult = response.ValidationResult;
            }

            /// <summary>
            /// 又一次安排约会
            /// </summary>
            public void Reschedule()
            {
                RescheduleRequest request = new RescheduleRequest();
                request.Target = new Entity() { LogicalName = entityName, Id = appointmentId };
                RescheduleResponse response = (RescheduleResponse)service.Execute(request);
                ValidationResult validationResult = response.ValidationResult;
            }

            /// <summary>
            /// 删除约会
            /// </summary>
            public void Delete()
            {
                service.Delete(entityName, appointmentId);
            }
        }

  • 相关阅读:
    决策树算法
    数据挖掘建模-Logistic回归
    Python数据结构与算法-栈和递归函数
    使用python自动化生成软件著作权的源代码
    一起玩转图论算法(1)图的基本表示
    全网最最最详细的软件著作权申请步骤
    时间序列模式(ARIMA)---Python实现
    宝塔面板怎样部署SSL证书?
    Linux基础概念入门
    转载:VMware workstation创建虚拟机,安装Ubuntu系统
  • 原文地址:https://www.cnblogs.com/yutingliuyl/p/6808859.html
Copyright © 2020-2023  润新知