using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query; /// <summary>
/// 传真
/// </summary>
public class FaxHelper
{
public static readonly string entityName = "fax";
public Guid faxId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建传真
/// </summary>
public void Create()
{
WhoAmIRequest userRequest = new WhoAmIRequest();
WhoAmIResponse userResponse = (WhoAmIResponse)service.Execute(userRequest);
Guid _userId = userResponse.UserId; Entity activityEn = new Entity() { LogicalName = "activityparty" };
activityEn["partyId"] = new EntityReference() { LogicalName = "systemuser", Id = _userId }; Entity en = new Entity() { LogicalName = entityName };
en["subject"] = "传值测试";
en["from"] = new Entity[] { activityEn };
en["to"] = new Entity[] { activityEn };
faxId = service.Create(en);
} /// <summary>
/// 将传真分派给其他用户或团队
/// </summary>
/// <param name="assignee">用户或团队引用</param>
public void Assign(EntityReference assignee)
{
AssignRequest request = new AssignRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = faxId };
request.Assignee = assignee;
AssignResponse response = (AssignResponse)service.Execute(request);
} /// <summary>
/// 发送传真
/// </summary>
public void SendFax()
{
SendFaxRequest request = new SendFaxRequest();
request.FaxId = faxId;
request.IssueSend = true;
SendFaxResponse response = (SendFaxResponse)service.Execute(request);
} /// <summary>
/// 删除指定的安全主体(用户或团队)对传真的所有访问权限
/// </summary>
/// <param name="revokee">用户或团队引用</param>
public void RevokeAccess(EntityReference revokee)
{
RevokeAccessRequest request = new RevokeAccessRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = faxId };
request.Revokee = revokee;
RevokeAccessResponse response = (RevokeAccessResponse)service.Execute(request);
} /// <summary> ///
/// 删除传真 ///
/// </summary>
public void Delete() { service.Delete(entityName, faxId); }
}

Fax Helper的更多相关文章

  1. [C#] 简单的 Helper 封装 -- RegularExpressionHelper

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. handlebars自定义helper的写法

    handlebars相对来讲算一个轻量级.高性能的模板引擎,因其简单.直观.不污染HTML的特性,我个人特别喜欢.另一方面,handlebars作为一个logicless的模板,不支持特别复杂的表达式 ...

  3. Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value '"*, Microsoft.AspNet.Mvc.TagHelpers"'

    project.json 配置: { "version": "1.0.0-*", "compilationOptions": { " ...

  4. VS2015突然报错————Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper

    Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with ...

  5. JavaScript模板引擎artTemplate.js——template.helper()方法

    上一篇文章我们已经讲到了helper()方法,但是上面的例子只是一个参数的写法,如果是多个参数,写法就另有区别了. <div id="user_info"></d ...

  6. [ASP.NET MVC 小牛之路]13 - Helper Method

    我们平时编程写一些辅助类的时候习惯用“XxxHelper”来命名.同样,在 MVC 中用于生成 Html 元素的辅助类是 System.Web.Mvc 命名空间下的 HtmlHelper,习惯上我们把 ...

  7. asp.net MVC helper 和自定义函数@functions小结

    asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...

  8. C# random helper class

      项目中经常需要模拟些假数据,来做测试.这个随机生成数据的helper类就应用而生: using System; using System.Text; using System.Windows.Me ...

  9. @helper函数使用方法

    这个函数方法,我也是通过别人博客看到的,感觉不错和大家一起学习分享一下. 1.自定义函数方法,只在同一个view视图文件里调用 Controller public ActionResult Index ...

随机推荐

  1. Java—maven项目管理

    Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建.报告和文档的软件项目管理工具. Maven环境搭建 http://maven.apache.org/download.c ...

  2. 对连接到 Azure 中 Linux VM 时出现的问题进行详细的 SSH 故障排除的步骤

    有许多可能的原因会导致 SSH 客户端无法访问 VM 上的 SSH 服务. 如果已经执行了较常规的 SSH 故障排除步骤,则需要进一步排查连接问题. 本文指导用户完成详细的故障排除步骤,以确定 SSH ...

  3. 十大创客与微软智能云Azure

    由微软举办的“2016年创客先锋—基于微软智能云Azure 的 SaaS 应用软件大赛”已于本周二在中关村圆满落幕.来自全国22家孵化园的创客,历时两个月,开发出百余项基于微软智能云Azure开发的创 ...

  4. C++数组怎么复制

    C++数组怎么复制: #include <string.h>main(){int a[10]={34,56,4,10,77,51,93,30,5,52};int b[10];memcpy( ...

  5. sqlserver根据条件生成插入语句--单表

    ALTER proc [dbo].[proc_insert] (@tablename varchar(256),@where varchar(max))asbeginset nocount ondec ...

  6. console和windows子系统

    https://blog.csdn.net/ilvu999/article/details/8050292

  7. 一款可以安利的MarkDown编辑器

    Typeora一款可以安利的MarkDown编辑器 Typeora是什么? ​ 一款使用MarkDown的本地编辑器集结了MarkDown的所有特点并展现了简洁.高效的特点,关键是免费. 特点: 支持 ...

  8. [EffectiveC++]item37:绝不重新定义继承而来的缺省参数值

    绝不重新定义继承而来的缺省参数值 静态类型 动态类型

  9. 优秀 Java 程序员写代码的风格

    往 期 精 彩 推 荐    [1]Java Web技术经验总结 [2]15个顶级Java多线程面试题及答案,快来看看吧 [3]面试官最喜欢问的十道java面试题 [4]从零讲JAVA ,给你一条清晰 ...

  10. Disruptor

    高性能队列Disruptor系列2--浅析Disruptor   目录 1. Disruptor简单介绍2. 为什么Disruptor如此之快3. Disruptor结构分析 1. Disruptor ...