Showing posts with label custom web site. Show all posts
Showing posts with label custom web site. Show all posts

Sep 24, 2012

Using CRM Webservice from custom web page (CRM 2011)

One of the previous posts we illustrated the way of using CRM service in custom page for CRM 4.0. Check it here.

Now we will see how the same task is accomplished in CRM 2011

If we put it in a method;

public static IOrganizationService getService()
{
ClientCredentials _cred = new ClientCredentials();

_cred.Windows.ClientCredential = new NetworkCredential("CRM_ADMIN_01", "F1xit@OR5", "CRMBIZDOMAIN");
string _url = "http://crmbiz:5555/abcltd/XRMServices/2011/Organization.svc";

OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(new Uri(_url), null, _cred, null);

return (IOrganizationService)serviceProxy;
}

Now the calling part;

Aug 21, 2012

Using CRM Webservice from custom web page (CRM 4.0)

Suppose we need to do any operation in CRM through a custom webpage. Now we need to use CRM web service in the most standard way. Below is the way we can instantiate and authenticate the service which could be used in our page.

If we put it in a method;

public static CrmService getCrmWebService(string _serverName, string _orgName)
        {

         CrmAuthenticationToken token = new CrmAuthenticationToken();
         token.AuthenticationType = 0;
         token.OrganizationName = _orgName;

         CrmService _service = new CrmService();
         _service.Url = "http://" + _serverName + "/mscrmservices/2007/crmservice.asmx";
         _service.CrmAuthenticationTokenValue = token;

         NetworkCredential _cred = new NetworkCredential();
         _cred.Domain = "CRMBIZDOMAIN";
         _cred.UserName = "CRM_ADMIN_01";
         _cred.Password = "F1xit@OR5";
         _service.Credentials = _cred;

         return _service;
        }

Calling part;

CrmService _CrmService = CrmCore.getCrmWebService("corp-biz01:5555", "AxCRM01");

Now any operation is possible.

 
To check how to do the same thing in CRM 2011, click here.