locked
Authentication crm On-premis from host code RRS feed

  • Question

  • I want to generate lead in crm server by using active directory authentication but I  want to put code on host web . will it generate the lead pls guide me how its possible
    Thursday, February 9, 2012 3:00 PM

Answers

  • Yes it will generate the lead.
    You just need to set the credentials as follows.

    ClientCredentials lclClientCredentials = new ClientCredentials();
    lclClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("UserName", "Password", "your servername");

    <hints id="hah_hints"></hints>


    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
    Muhammad Mubasher, CRM Developer, The CRM Solutions Pvt Ltd.
    My Blogs: http://mubashersharif.blogspot.com
    My Linkedin: http://pk.linkedin.com/pub/muhammad-mubasher/34/548/305
    My Twitter: https://twitter.com/#!/mubashersharif

    • Proposed as answer by MubasherSharif Wednesday, April 4, 2012 8:09 PM
    • Marked as answer by Faisal Imran Thursday, April 5, 2012 5:10 PM
    Wednesday, April 4, 2012 8:09 PM

All replies

  • Hi Faisal,

    Entity entity = new Entity("new_entity");

                    entity.Attributes["new_name"] = "Khaja";
                    entity.Attributes["new_campaignname"] = jsDeserialize["nameofset"];
                    entity.Attributes["new_id"] = Convert.ToInt32(jsDeserialize["callsetid"]);
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential.UserName = "username";
    credentials.Windows.ClientCredential.Password = "password";
    credentials.Windows.ClientCredential.Domain = "domain";
    var _serviceProxy = new OrganizationServiceProxy(new Uri("http://crm:5555/Test1/XRMServices/2011/Organization.svc"),null,credentials,GetDeviceCredentials());
    WhoAmIRequest reques = new WhoAmIRequest();
    WhoAmIResponse response = (WhoAmIResponse)_serviceProxy.Execute(reques);
    if (_serviceProxy != null)
    {
    _serviceProxy.Create(entity);
    }

    In the above code you need to change the entity name to lead.

    Regards,


    Khaja Mohiddin|||||http://www.dynamicsexchange.com/

    • Proposed as answer by Khaja Mohiddin Friday, February 10, 2012 9:56 AM
    Friday, February 10, 2012 9:56 AM
  • Yes it will generate the lead.
    You just need to set the credentials as follows.

    ClientCredentials lclClientCredentials = new ClientCredentials();
    lclClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("UserName", "Password", "your servername");

    <hints id="hah_hints"></hints>


    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
    Muhammad Mubasher, CRM Developer, The CRM Solutions Pvt Ltd.
    My Blogs: http://mubashersharif.blogspot.com
    My Linkedin: http://pk.linkedin.com/pub/muhammad-mubasher/34/548/305
    My Twitter: https://twitter.com/#!/mubashersharif

    • Proposed as answer by MubasherSharif Wednesday, April 4, 2012 8:09 PM
    • Marked as answer by Faisal Imran Thursday, April 5, 2012 5:10 PM
    Wednesday, April 4, 2012 8:09 PM