zoukankan      html  css  js  c++  java
  • mscrm4.0 获取当前登录的用户名

    var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
    "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
    "  <soap:Body>" +
    "    <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\" xmlns=\"http://schemas.microsoft.com/crm/2006/WebServices\">" +
    "      <q1:EntityName>systemuser</q1:EntityName>" +
    "      <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
    "        <q1:Attributes>" +
    "          <q1:Attribute>systemuserid</q1:Attribute>" +
    "          <q1:Attribute>fullname</q1:Attribute>" +
    "        </q1:Attributes>" +
    "      </q1:ColumnSet>" +
    "      <q1:Distinct>false</q1:Distinct>" +
    "      <q1:Criteria>" +
    "        <q1:FilterOperator>And</q1:FilterOperator>" +
    "        <q1:Conditions>" +
    "          <q1:Condition>" +
    "            <q1:AttributeName>systemuserid</q1:AttributeName>" +
    "            <q1:Operator>EqualUserId</q1:Operator>" +
    "          </q1:Condition>" +
    "        </q1:Conditions>" +
    "      </q1:Criteria>" +
    "    </query>" +
    "  </soap:Body>" +
    "</soap:Envelope>" +"";

    var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

    xmlHttpRequest.Open(
    "POST""/mscrmservices/2006/CrmService.asmx"false);
    xmlHttpRequest.setRequestHeader(
    "SOAPAction","http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple");
    xmlHttpRequest.setRequestHeader(
    "Content-Type""text/xml; charset=utf-8");
    xmlHttpRequest.setRequestHeader(
    "Content-Length", xml.length);
    xmlHttpRequest.send(xml);

    var doc = xmlHttpRequest.responseXML;
    var user = doc.selectSingleNode("//BusinessEntity");

    var userId = user.selectSingleNode("systemuserid").text;
    alert(userId);

    var userName = user.selectSingleNode("fullname").text;
    alert(userName);
  • 相关阅读:
    C语言 assert 函数
    C语言 exit 函数
    C语言 main 函数参数 main(int argc, char *argv[])
    《一线架构师实践指南》读后感(一)
    机器学习十讲第八讲
    机器学习十讲第七讲
    Python通过IMAP实现邮箱客户端
    ABAP-PS操作
    ABAP-AES加解密
    ABAP-HmacSHA256
  • 原文地址:https://www.cnblogs.com/seerlin/p/1979477.html
Copyright © 2011-2022 走看看