我们之前创建的plugin都是使用default的 run in User's Context.

理解就是使用正在登陆的security context用户信息

那有个问题,如果当前用户的security role没有相应的权限访问功能,我们就要安排一个新的用户 e.g. admin来记录信息而非当前用户.

让我们在registration tool更新TaskCreate class之后再CRM中打开新建Contacts.

我们可以打开activities发现follow up 里用户更改为在plugin registration tool中更改的用户.

第二种方法,我们可以做impersonation 的地方是plugin 的代码当中

首先我们把run in user's context 改为Calling User

首先我们要先知道admin的GUID,知道GUID之后我们才可以创建一个新的OrganizationService.

            // This is for the impersonation
IOrganizationService adminService = serviceFactory.CreateOrganizationService(new Guid());

其次, 我们用创建好的adminService在try中做创建task.

// Inpersonation in Plugins
adminService.Create(taskRecord);

创建一个dynamics 365 CRM online plugin (七) - plugin当中的Impersonation角色的更多相关文章

  1. 创建一个dynamics 365 CRM online plugin (九) - Context.Depth

    让我们来看看官方文档是怎么讲的 https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide ...

  2. 创建一个dynamics 365 CRM online plugin (四) - PreValidation

    开始之前,我们要确认一下 Plugin 的 pipeline. PreValidation -> PreOperation -> Server Side System Main Event ...

  3. 创建一个dynamics 365 CRM online plugin (三) - PostOperation

    上两节我们创建了一个 PreOperation的plugin 今天我们创建一个PostOpeartion的plugin和之前的plugin连接起来 当创建contact之后,我们要添加一个task给新 ...

  4. 创建一个dynamics 365 CRM online plugin (一) - Hello World Plugin

    源代码连接:https://github.com/TheMiao/Dynamics365CRM/blob/master/MyCRM/MyCRM/HelloWorld.cs 首先,我们需要创建一个.NE ...

  5. 创建一个dynamics 365 CRM online plugin (十) - Isolation mode or trust mode

    Isolation Mode 也被称作为Plugin Trust CRM里面有两种plugin trust / isolation mode 1. Full Trust 只在OP系统中可使用,没有限制 ...

  6. 创建一个dynamics 365 CRM online plugin (五) - Images in Plugin

    Snapshots of the primary entity's attributes from database before(pre) and after (post) the core pla ...

  7. 创建一个dynamics 365 CRM online plugin (八) - 使用Shared Variables 在plugins 之前传递data

    CRM 可以实现plugin之前的值传递. 我们可以使用SharedVariables 把值在plugin之间传递 实现plugins之间的传递非常简单,我们只需要用key value pair来配对 ...

  8. 创建一个dynamics 365 CRM online plugin (六) - Delete plugin from CRM

    我们之前都学习到怎么添加,debug还有update plugin. 今天带大家过一下怎么从CRM instance当中删除plugin. 首先让我们打开Settings -> Customiz ...

  9. 创建一个dynamics 365 CRM online plugin (二) - fields检查

    Golden Rules 1. Platform only passes Entity attributes to Plugin that has change of data. 2. If the ...

随机推荐

  1. Dictionary集合运用

    Dictionary基础定义: 从一组键(key)到一组值(value)的映射,每一个添加项都是由一个值及其相关联的键组成: 任何键都必须是唯一的: 键不能为空引用的null(VB中的Nothing) ...

  2. paramiko__摘抄

    # -*- coding:utf-8 -*-# Author: Dennis Huang__Author__ = "Dennis" import paramiko # ssh = ...

  3. Fasttext原理

    fastText 模型输入一个词的序列(一段文本或者一句话),输出这个词序列属于不同类别的概率.序列中的词和词组组成特征向量,特征向量通过线性变换映射到中间层,中间层再映射到标签.fastText 在 ...

  4. redis cluster最简配置

    redis cluster最简配置 master配置如下:(默认6379端口) bind 127.0.0.1 port 6379 timeout 0 databases 16 Master的redis ...

  5. linux之关于学习必备知识

    文件列表的定义: 第一个字符表示文件类型  d为目录  -为普通  1为链接  b为可存储的设备接口  c为键盘鼠标等输入设备 2~4个字符表示所有者权限,5~7个字符表示所有者同组用户权限,8~10 ...

  6. 1. 做node项目 (第二个月)

    工作栈: Node + Express + Mongoose +  Mongodb + Vuejs 主要做了 mongodb的 curd , 因为以前做 PHP + MySql 所以基本大同小异. n ...

  7. ES6 模板字符串Template String

    1. 模板字符串简介: 顾名思义,模板字符串是用来定义一个模板是使用的,就像Vue,React中的template语法. 首先,先来了解一下template string的基本用法: 在ES5中,我们 ...

  8. python基础一之while循环随机猜数字

    # Author:"Mamba" import random setNum = random.randint(1,10) #print(setNum) count = 0 whil ...

  9. HttpClient 通过代理访问验证服务器

    import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import ...

  10. 直接执行sql字符串

    $sql_tmp= "UPDATE `eabc_order_detail` set send_number=num where order_sn='".$model_order-& ...