我们之前创建的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. 程序执行流程:猜数字游戏;库的使用:turtle

    >>> import turtle >>> turtle.circle(50) >>> turtle.circle(100) Python 3.6 ...

  2. Can peel peel solve pesticide problem

    Can peel peel solve pesticide problem? Middle peasants medicinal modern agriculture more and more, t ...

  3. Asp.Net Core通过HttpStatusCode状态处理响应结果

    在我的一个Asp.Net Core 2.1 的项目中,我们需要通过获得服务器返回的状态,去实现不用的操作,经过多方资料查询和实践,个人总结一种方法 一.修改控制器 在要返回值的控制器Action中,R ...

  4. java HttpClient 忽略证书的信任的实现 MySSLProtocolSocketFactory

    当不需要任何证书访问https时,java中先实现一个MySSLProtocolSocketFactory类忽略证书的信任 package com.tgb.mq.producer.utils; imp ...

  5. Swing学习2——图标添加Icon接口使用

    废话没有,看代码. 主要就是通过实现Icon接口在标签添加一个圆形图标,并在框架中显示. package com.sword.swing_test; import javax.swing.*; imp ...

  6. RobotFramework之Run Keyword的使用

    RobotFramework之Run Keyword的使用        在之前写的RobotFramework(二)中有提到过这个Run Keyword关键字的使用,但是再做检查判断的时候,发现它的 ...

  7. jar包是干什么用的

    1.JAR(Java ARchive)是将一系列文件到单个压缩文件里,就象Zip那样.但是,同Java中其他任何东西一样,JAR文件是跨平台的,所以不必关心涉及具体平台的问题.2.jar包就是别人已经 ...

  8. python自动生成bean类

    近期在学习python,一直在和java做对比,目前没有发现有通过字段自动生成getter setter方法,故此自己写了一个类,可以通过__init__方法传入类名和字段数组,再调用内部的方法,就可 ...

  9. Java编程思想 - 第11章 持有对象

    · 大量笔记存放在Github Java文件中,请移步查看:https://github.com/iGuure/AndroidCodeHub/tree/master/Java%20pratice/Th ...

  10. VB Mouse Pointer