//取消訪问权限

function demo() {

    //操作记录的id

    var targetId = "A8A46444-BA10-E411-8A04-00155D002F02";

    //操作记录的实体名称

    var targetType = "new_config";

    //被分配的用户或者团队的id

    var assignId = "48025176-2B0E-E411-BA68-00155D002F02";

    //systemuser或者team

    var assignType = "systemuser";

   

    RevokeAccess(targetId, targetType, assignId, assignType);

}

function RevokeAccess(targetId, targetType, assignId, assignType) {

    var request = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";

    request += "<s:Body>";

    request += "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\"";

    request += " xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";

    request += "<request i:type=\"b:RevokeAccessRequest\"";

    request += " xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"";

    request += " xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">";

    request += "<a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";

    request += "<a:KeyValuePairOfstringanyType>";

    request += "<c:key>Target</c:key>";

    request += "<c:value i:type=\"a:EntityReference\">";

    request += "<a:Id>" + targetId + "</a:Id>";

    request += "<a:LogicalName>" + targetType + "</a:LogicalName>";

    request += "<a:Name i:nil=\"true\" />";

    request += "</c:value>";

    request += "</a:KeyValuePairOfstringanyType>";

    request += "<a:KeyValuePairOfstringanyType>";

    request += "<c:key>Revokee</c:key>";

    request += "<c:value i:type=\"a:EntityReference\">";

    request += "<a:Id>" + assignId + "</a:Id>";

    request += "<a:LogicalName>" + assignType + "</a:LogicalName>";

    request += "<a:Name i:nil=\"true\" />";

    request += "</c:value>";

    request += "</a:KeyValuePairOfstringanyType>";

    request += "</a:Parameters>";

    request += "<a:RequestId i:nil=\"true\" />";

    request += "<a:RequestName>RevokeAccess</a:RequestName>";

    request += "</request>";

    request += "</Execute>";

    request += "</s:Body>";

    request += "</s:Envelope>";

execSoap(request);

}

//获取服务地址

function getWebUrl() {

    var serverUrl = Xrm.Page.context.getServerUrl();

    if (serverUrl.match(/\/$/)) {

        serverUrl = serverUrl.substring(0, serverUrl.length - 1);

    }

    return serverUrl + "/XRMServices/2011/Organization.svc/web";

}

//运行请求

function execSoap(request) {

    var ajaxRequest = new XMLHttpRequest();

    ajaxRequest.open("POST", getWebUrl(), true)

    ajaxRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");

    ajaxRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

    ajaxRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");

    ajaxRequest.send(request);

}

crm使用soap取消用户訪问记录权限的更多相关文章

  1. php 获取/设置用户訪问页面语言类

    User Language Class 获取/设置用户訪问的页面语言,假设用户没有设置訪问语言.则读取Accept-Language. 依据用户选择的语言显示相应的页面(英文.中文简体,繁体中文) U ...

  2. JAVA基础之訪问控制权限(封装)

    包:库单元 1.当编写一个Java源码文件时.此文件通常被称为编译单元(有时也被称为转译单元). 2.每一个编译单元都必须有一个后缀名.java,而在编译单元内则能够有一个public类,该类名称必须 ...

  3. nginx access.log 忽略favicon.ico訪问记录的方法

    favicon.ico 文件是浏览器收藏网址时显示的图标,当第一次訪问页面时.浏览器会自己主动发起请求获取页面的favicon.ico文件.当/favicon.ico文件不存在时,服务器会记录404日 ...

  4. oracle跨数据库跨用户訪问注意事项

    java代码中不同意出现oracle的username.数据链路名. 跨用户.跨数据库的訪问必须在oracle中建同义词或视图来实现.在java代码中仅仅需当做当前用户下的对象处理.

  5. C++ 訪问控制权限图解

    基类訪问权限 类继承方式 子类訪问权限           public   public   protected public protected   private   No Access   p ...

  6. crm使用soap启用和停用记录

    function demo() {     //操作记录的id     var targetId = "a8a46444-ba10-e411-8a04-00155d002f02"; ...

  7. [加入用户]解决useradd 用户后没有加入用户Home文件夹的情况,Linux改变文件或文件夹的訪问权限命令,linux改动用户password,usermod的ysuum安装包。飞

    usermod的yum安装包: shadow-utils 将nobody用户加入到nogroup 组: usermod -g nogroup nobody cat /etc/passwd|grep n ...

  8. Windows server2008 搭建ASP接口訪问连接oracle数据库全过程记录

    真的是太不easy了,曾经的时候在window server 2003上面搭建了一套asp+oracle的接口系统.就费了好大的劲儿,事实上那会迷迷瞪瞪的也不知道怎么的就弄好了,也懒得管了.OK,从昨 ...

  9. MYSQL加入远程用户或同意远程訪问三种方法

    加入远程用户admin密码为password GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY \'password\' WIT ...

随机推荐

  1. MFC下CSocket编程详解(转)

    原文转自 http://blog.csdn.net/yejiansnake/article/details/2175778 MFC下CSocket编程详解: 1. 常用的函数和注意事项(详细的函数接口 ...

  2. xen save/restore 过程

    以下分析基于 xen4.2.3, 虚拟机都是hvm模式 使用libxl库有两种方式启动一个虚拟机,一种是 xl create xx.conf , 这种方式从一个配置文件开始启动一个虚拟机,速度相对较慢 ...

  3. python grequests和requests比较

    #!/usr/bin/env python # encoding: utf-8 import grequests import requests import timeit import time d ...

  4. 原来是adblock惹的祸

    一个在本地开发好的网站,放到服务器就不行了.花了好几个小时的时间,最后试着把adblock关了,然后正常了.

  5. (15)oracle序列

    1.创建序列 CREATE SEQUENCE EMP_SEQ START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE ...

  6. java 概括

    作者:Dnvce链接:https://www.zhihu.com/question/61950442/answer/441166734来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载 ...

  7. 使用GEANT4的模拟技术1

    简介 本文来源于意大利国家核物理研究院INFN的08年的slides.原文名称simulation techniques using geant4,原文主要讲述的是开发geant4用户程序的方法.这里 ...

  8. Walls and Gates -- LeetCode

    You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstac ...

  9. bzoj 5163: 第k大斜率

    5163: 第k大斜率 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 15  Solved: 4[Submit][Status][Discuss] D ...

  10. C# 事件和Unity3D

    http://zijan.iteye.com/blog/871207 翻译自: http://www.everyday3d.com/blog/index.php/2010/10/04/c-events ...