none
From where I can get Microsoft.CRM.Service.Utility dll ?

    Question

  • Hi pals,I'm trying to create a contact record in MSCRM2011 online using an external web page.I couldn't find Microsoft.CRM.Service.Utility dll from sdk. can anybody help me.. 

    Thanks ...  :)

    using System;
    using Microsoft.Crm;
    using Microsoft.Crm.Tools;
    using System.Net;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Crm.Services.Utility;   // * Did not referenced
    using System.ServiceModel.Description;
    using Microsoft.Xrm.Sdk.Client;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Web.Services;

    public partial class crm_contact : System.Web.UI.Page
    {

        private static ClientCredentials GetDeviceCredentials()
        {
            return Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice();
        }



        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {

        



            {
                //Authenticate using credentials of the logged in user;       
                ClientCredentials Credentials = new ClientCredentials();
                //Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
                Credentials.UserName.UserName = "users.onmicrosoft.com";
                Credentials.UserName.Password = "Pass1";
                //This URL needs to be updated to match the servername and Organization for the environment.
                Uri OrganizationUri = new Uri("https://******.api.crm5.dynamics.com/XRMServices/2011/Organization.svc");
                Uri HomeRealmUri = null;
           
                //OrganizationServiceProxy serviceProxy;       
                using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri,Credentials,GetDeviceCredentials()))
                {
                    serviceProxy.EnableProxyTypes();
                    IOrganizationService service = (IOrganizationService)serviceProxy;

                    //Instantiate the contact object and populate the attributes.
                    Entity contact = new Entity("contact");
                    contact["firstname"] = txtFirstName.Text.ToString();
                    contact["lastname"] = txtLastName.Text.ToString();
                    contact["emailaddress1"] = txtEmailAddress.Text.ToString();
                    contact["telephone1"] = txtPhoneNumber.Text.ToString();
                    Guid newContactId = service.Create(contact);

                    //This code will clear the textboxes after the contact is created.
                    txtFirstName.Text = "";
                    txtLastName.Text = "";
                    txtEmailAddress.Text = "";
                    txtPhoneNumber.Text = "";
                }
            } 
        }
    }



    • Edited by Tony Ryder Tuesday, August 06, 2013 5:26 AM
    Wednesday, June 12, 2013 5:01 AM

All replies

  • this is not a dll, this is in the SDK sample code devicemanager

    $sdk\samplecode\cs\helpercode\devicemanager

    then you should got reference

    Wednesday, June 12, 2013 5:18 AM
  • this is not a dll, this is in the SDK sample code devicemanager

    $sdk\samplecode\cs\helpercode\devicemanager

    then you should got reference

    Hi,Marshall thanks for your reply,

    I have already put the Deviceidmanager.cs file in to the directory...

    Exception is The type or namespace name 'Services' does not exist in the namespace 'Microsoft.Crm' (are you missing an assembly reference?)


    Wednesday, June 12, 2013 5:31 AM
  • Hi,

    that's because of missing DeviceIdManager Class in your project.

    Add this class file to your project.


    Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, June 12, 2013 5:33 AM
  • Hi,

    that's because of missing DeviceIDmanager in your project.

    Add this class file to your project.


    Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Hi,

    DeviceidManager.cs is already there inside my website directory.

    thanks.

    Wednesday, June 12, 2013 5:41 AM
  • Hi,

    Actually , It is not a .dll but a class you need to add to your project.

    Essentially the old 3.0 CRMHelper class.

    If you've downloaded the 4.0 SDK, search for 'crmserviceutility.cs' and add to your project. Under 4.0 SDK\server\reference\cs.



    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Wednesday, June 12, 2013 6:10 AM
  • Hi,

    Actually , It is not a .dll but a class you need to add to your project.

    Essentially the old 3.0 CRMHelper class.

    If you've downloaded the 4.0 SDK, search for 'crmserviceutility.cs' and add to your project. Under 4.0 SDK\server\reference\cs.



    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    thank u for ur reply Mr.Rk Pol ..
    Sunday, June 16, 2013 5:42 AM
  • Finally we need both of them:

    CrmServiceHelpers.cs

    DeviceIdManager.cs

    to add to project

    Wednesday, September 13, 2017 11:41 AM