Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011

Tuesday, April 16, 2019

SOLVED ERROR - Cannot find assembly "Microsoft.SqlServer.ManagedDTS" when calling an SSIS agent job from C# code


In this article we describe how to find the assembly "Microsoft.SqlServer.ManagedDTS"  when calling an SSIS agent job from C# code.

When calling an Sql Server Integration Services agent job SSIS programmatically from C# .Net code, in order to use the method  Execute , there is a need for using in the application the reference to the assembly  Microsoft.SqlServer.ManagedDTS .

The problem resides in finding that DLL . It should be installed in the pc, together with the rest of SQL SERVER DLLs.



How to find the assembly "Microsoft.SqlServer.ManagedDTS"  when calling an SSIS agent job from C# code



The first try will be to add the assembly via the assemblies list box in visual studio , only to find that it was not available there:




Then, we could go to the  SQL SERVER assemblies  folder : C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
Again, it will not be possible to get the assembly that way:





SOLUTION: 
Press WIN KEY + R to open the Run window , and run the GAC command : 


    C:\Windows\assembly\gac_msil


The GAC will open, and then make a search for the ManagedDTS assembly :

Copy it to the BIN folder of your VISUAL STUDIO project, then open the reference manager and BROWSE for it in the BIN folder :






Add the "Using" reference to your Project .
That's all...
In this article we've seen Step by step how to find the assembly "Microsoft.SqlServer.ManagedDTS" when calling an SSIS agent job from C# code.
Enjoy Microsoft Dynamics 365 CRM!

by Carmel Schvartzman

כתב: כרמל שוורצמן










    Dynamics 365 - How to Create a new Entity record using Web API and Javascript in 5 minutes

    In this article we describe Step by step  How to Create a new Entity record  using Web API and Javascript in 5 minutes. We'll use the JQuery already loaded by Dynamics 365 on the form.

    For this example, we'll create a Contact record, when clicking a button, using a Web Resource locally inside the Form.


    How to Create a new Entity record  using Web API and Javascript in 5 minutes



    This is the function to Create a Record , using an HTTP POST request: 


    var entity = {};
    entity.address1_telephone1 = "";
    entity.emailaddress1 = "";
    entity.lastname = "";

    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts",
        data: JSON.stringify(entity),
        beforeSend: function(XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
            XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        async: true,
        success: function(data, textStatus, xhr) {
            var uri = xhr.getResponseHeader("OData-EntityId");
            var regExp = /\(([^)]+)\)/;
            var matches = regExp.exec(uri);
            var newEntityId = matches[1];
        },
        error: function(xhr, textStatus, errorThrown) {
            Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
        }
    });



    And this is the Web Resource EMBEDDED in the Form (that's why we wrote "parent" before calls to JQuery ) :
    1) Open the Form
    2) Add > Section > Web Resource
    3) Paste inside it the following HTML - JS code:



    <html><head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <script>

    var fnCreateContact = () => {
    var entity = {};
    entity.address1_telephone1 = "123123123";
    entity.emailaddress1 = "www.bender.com";
    entity.lastname = "Contact Name";

    parent.$.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts",
        data: JSON.stringify(entity),
        beforeSend: function(XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
            XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        async: true,
        success: function(data, textStatus, xhr) {
            var uri = xhr.getResponseHeader("OData-EntityId");
            var regExp = /\(([^)]+)\)/;
            var matches = regExp.exec(uri);
            var newEntityId = matches[1];

    document.getElementById('btnCreateContact').classList.add('disabled');
        },
        error: function(xhr, textStatus, errorThrown) {
            parent.Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
        }
    });
    }
    </script>
    <meta></head><body style="direction: rtl; overflow-wrap: break-word;">

    <div class="container">
      <div class="jumbotron">
        <h3>Create Contact</h3>   
        <p>This function creates a new Contact</p>
         <button id="btnCreateContact" onclick="fnCreateContact()" type="button" class="btn btn-primary">Create Contact</button>
      </div>
    </div>

    </body></html>






    That's all...
    In this article we've seen Step by step  How to Create a new Entity record  using Web API and Javascript in 5 minutes.
    Enjoy Microsoft Dynamics 365 CRM!

    by Carmel Schvartzman

    כתב: כרמל שוורצמן