Fax Helper
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的更多相关文章
- [C#] 简单的 Helper 封装 -- RegularExpressionHelper
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- handlebars自定义helper的写法
handlebars相对来讲算一个轻量级.高性能的模板引擎,因其简单.直观.不污染HTML的特性,我个人特别喜欢.另一方面,handlebars作为一个logicless的模板,不支持特别复杂的表达式 ...
- 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": { " ...
- 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 ...
- JavaScript模板引擎artTemplate.js——template.helper()方法
上一篇文章我们已经讲到了helper()方法,但是上面的例子只是一个参数的写法,如果是多个参数,写法就另有区别了. <div id="user_info"></d ...
- [ASP.NET MVC 小牛之路]13 - Helper Method
我们平时编程写一些辅助类的时候习惯用“XxxHelper”来命名.同样,在 MVC 中用于生成 Html 元素的辅助类是 System.Web.Mvc 命名空间下的 HtmlHelper,习惯上我们把 ...
- asp.net MVC helper 和自定义函数@functions小结
asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...
- C# random helper class
项目中经常需要模拟些假数据,来做测试.这个随机生成数据的helper类就应用而生: using System; using System.Text; using System.Windows.Me ...
- @helper函数使用方法
这个函数方法,我也是通过别人博客看到的,感觉不错和大家一起学习分享一下. 1.自定义函数方法,只在同一个view视图文件里调用 Controller public ActionResult Index ...
随机推荐
- maven学习(四)maven的生命周期
官网:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html maven有三套相互独立的生命周期, ...
- SQLite入门(二)读写二进制数据
//读二进制数据的函数 BOOL OpenBinDataFile(BYTE **pBUf,UINT &len) { if (pBUf == NULL) { re ...
- cookie的初识和运用(js和jq)
cookie是什么 cookie是浏览器提供的一种机制,它将document 对象的cookie属性提供给JavaScript.可以由JavaScript对其进行控制,而并不是JavaScript本身 ...
- CSS中DIV只出现竖向滚动条且内容自动换行
只需要设置如下的样式即可: <div id="testDiv" style="overflow-x: hidden; word-break:break-all;bo ...
- 加密算法IV的作用
使用随机数产生的初始化向量才能达到语义安全(散列函数与消息验证码也有相同要求),并让攻击者难以对同一把密钥的密文进行破解 初始化向量的值依密码算法而不同.最基本的要求是“唯一性”,也就是说同一把密钥不 ...
- 一个U盘黑掉你:TEENSY实战
从传统意义讲,当你在电脑中插入一张CD/DVD光盘,或者插入一个USB设备时,可以通过自动播放来运行一个包含恶意的文件,不过自动播放功能被关闭时,autorun.inf文件就无法自动执行你的文件了.然 ...
- js call、apply和bind
function add(a,b) { alert(a+b); } function sub(a,b) { alert(a-b); } add.call(sub,3,1); 例1 例子1中的意思就是用 ...
- ClipboardJS 实现JS复制到剪切板
根据官方文档的说法这个支持IE9+以及大部分主流浏览器,地址:https://clipboardjs.com/ 下面写个简单的例子:HTML:注意,这里最好是button,并非所有的元素都支持该JS ...
- BZOJ5301:[CQOI2018]异或序列(莫队)
Description 已知一个长度为 n 的整数数列 a[1],a[2],…,a[n] ,给定查询参数 l.r ,问在 [l,r] 区间内,有多少连续子 序列满足异或和等于 k . 也就是说,对于所 ...
- 动量法应用NASA测试不同飞机机翼噪音
%matplotlib inline from mxnet import nd import numpy as np from mxnet import autograd,gluon,init,nd ...