简体   繁体   English

如何将Dynamics CRM的组织数据服务与Node.js应用程序连接

[英]How to connect organization data service of dynamics crm with node.js application

How do I connect to the organization data service of Dynamics CRM with a node.js application? 如何使用node.js应用程序连接到Dynamics CRM的组织数据服务?

I do not have web api in developer resource, so how to get data with organization data service? 我在开发人员资源中没有Web API,那么如何使用组织数据服务获取数据?

动态crm版本iamge ... ... 开发人员资源图片

If you are using CRM 2016 or later Use the Microsoft Dynamics 365 Web API 如果您使用的是CRM 2016或更高版本, 请使用Microsoft Dynamics 365 Web API

The Web API, which is new for Microsoft Dynamics 365 (online & on-premises), provides a development experience that can be used across a wide variety of programming languages, platforms, and devices. Web API是Microsoft Dynamics 365(在线和本地)的新增功能,可提供可在多种编程语言,平台和设备上使用的开发体验。 The Web API implements the OData (Open Data Protocol), version 4.0, an OASIS standard for building and consuming RESTful APIs over rich data sources. Web API实现了OData(开放数据协议)版本4.0,这是用于通过丰富数据源构建和使用RESTful API的OASIS标准。

Because the Web API is built on open standards, we don't provide assemblies for a specific developer experience. 由于Web API是基于开放标准构建的,因此我们不提供针对特定开发人员体验的程序集。 You can compose HTTP requests for specific operations or use third-party libraries to generate classes for whatever language or platform you want. 您可以为特定操作编写HTTP请求,也可以使用第三方库为所需的任何语言或平台生成类。

If you are using CRM 2015 or earlier use the Organization Service (aka SOAP endpoint) . 如果您使用的是CRM 2015或更早版本,请使用Organization Service(又名SOAP端点)

Available since CRM 2011 the service provided a classic SOAP endpoint and is probably the most commonly used web service. 自2011年CRM开始可用,该服务提供了经典的SOAP端点,并且可能是最常用的Web服务。 This service provides access to the full range of 365 operations, and messages. 该服务提供对全部365种操作和消息的访问。 For .Net developers the SDK provides a set of assemblies that mean using the service is simple with the complexities of the SOAP endpoint abstracted away. 对于.Net开发人员,SDK提供了一组程序集,这意味着使用该服务非常简单,并且抽象出了SOAP端点的复杂性。 Non-.Net developers have a more challenging environment and they must communicate directly with the SOAP endpoint which is typically a far more complicated affair. 非.Net开发人员的环境更具挑战性,他们必须直接与SOAP端点进行通信,而SOAP端点通常是一件更为复杂的事情。

Am sharing the github code sample from this blog . 正在共享此博客中的github代码示例。

This uses OrganizationData service from Node.js script to pull FullName of Contacts (ContactSet). 这使用Node.js脚本中的OrganizationData服务来提取联系人的全名(ContactSet)。

    // Set the headers for the call to CRM
    var headers = {
      'Authorization': 'Bearer ' + sess.access_token, //send the oauth access token to authenticate
      'Accept': 'application/json' //tell CRM to send json data back
    }

    //configure the CRM odata request
    var options = {
      host : crm_host,
      port : crm_port,
      path : '/XRMServices/2011/OrganizationData.svc/ContactSet?$select=FullName', //hardcoded to select just the contact name
      method : 'GET',
      rejectUnauthorized: false,//to allow for self-signed SSL certificates - use at your own risk!!!
      headers : headers //set in the previous step
    };
    
    var reqGet = https.request(options, function(resGet) {
      //should do something here if we get 'www-authenticate': 'Bearer error' response headers
      //console.log("headers: ", resGet.headers);
      
      resGet.on('data', function(d) {
        //console.info('raw response: ' + d);
        var json = JSON.parse(d);
        var records = json.d.results;
        
        //console.info('results: ' + JSON.stringify(records));
        for (var i in records) {   
          res.write(records[i].FullName + '<br />');
        }
        res.write('</body>');
        res.write('</html>');
        res.end();
      });
    });
    reqGet.end();
    
    //handle errors
    reqGet.on('error', function(e) {
      console.error(e);
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Node.js以编程方式将Web资源上载到Microsoft Dynamics CRM - Upload web resource to Microsoft Dynamics CRM programmatically with Node.js Dynamics CRM Online + Node.js(请求永远运行/挂起) - Dynamics CRM Online + Node.js (request runns forever /hangs) 如何使用javascript(node.js)从Microsoft Dynamics CRM接收Webhooks? - How to receive webhooks from Microsoft's dynamics CRM using javascript(node.js)? 如何将C ++应用程序与node.js服务器连接以获取JSON数据? - How can I connect my C++ application with an node.js server to get JSON data? 如何从 Node.js 应用程序连接 AWS elasticache redis? - How to connect AWS elasticache redis from Node.js application? 如何将静态HTML和CSS文件连接到Node.js应用程序? - How to connect static HTML and CSS files to Node.js application? 如何连接到 openshift node.js 应用程序上的远程 oracle 数据库? - How to connect to a remote oracle database on an openshift node.js application? 如何从 Node.js 应用程序连接到 Heroku 上的 PostgresSQL? - How to connect to PostgresSQL on Heroku from a Node.js application? 如何使用 mongoose 将本地 mongodb 与 node.js 应用程序连接起来? - how to connect local mongodb with a node.js application using mongoose? 如何在Red Hat Linux上将Node.js应用程序设置为服务 - How to setup a Node.js application as a service on Red Hat Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM