Accessing CrmService live or online


This are some of the best articles for this

http://msdn.microsoft.com/en-us/library/bb955360.aspx

http://msdn.microsoft.com/en-us/library/dd548517.aspx

http://blogs.msdn.com/crm/archive/2008/03/10/accessing-crm-live-web-services.aspx

http://blog.philiprichardson.org/2007/12/17/part-3-applications-which-connect-to-crm/

The important thing to remember is that here we need to use the organization’s unique name.

For example the friendly name here is Bliss

the unique name is org582c8 which could be found at

settings—>customization—> Download web service description files.

We need to make use of idcrlwrapper.dll and msidcrl40.dll which needs to placed in our project’s bin\debug folder.

To get  idcrlwrapper.dll we need to do the following

http://msdn.microsoft.com/en-us/library/bb955358.aspx

And lastly we need to add a cs file named windowsliveidticketacquirer.cs in our project. It could be found at the following location

SDK\server\helpers\cs\CrmOnlineAuth.

// Login information For authentication through the Windows Live service.
Static Private String _username = "username@hotmail.com";
Static Private String _password = "password";
Static Private String _partner = "crm.dynamics.com";
Static Private String _environment = "Production";
// Set the name And TCP port Of the server hosting Microsoft Dynamics CRM Live.
Static Private String _hostname = "dev.crm.dynamics.com";
//Set the friendly name Of the target organization.
Static Private String _orgFriendlyName = "Bliss";
// Define an expired authentication ticket Error code.
Static Private String EXPIRED_AUTH_TICKET = "8004A101";
//Passport ticket required To recover from a CrmTicket time out.
Static Private String _passportTicket;
//Attempt a service Call a maximum number Of times before failing.
Static Private int MAX_RETRIES = 5;
Private void Form1_Load(Object sender, EventArgs e)
{
// Step 1,2: Retrieve a policy from the Discovery Web service.
CrmDiscoveryService discoveryService = New CrmDiscoveryService();
discoveryService.Url = String.Format(
"https://{0}/MSCRMServices/2007/{1}/CrmDiscoveryService.asmx",
_hostname, "Passport");
RetrievePolicyRequest policyRequest = New RetrievePolicyRequest();
RetrievePolicyResponse policyResponse =
(RetrievePolicyResponse)discoveryService.Execute(policyRequest);
// Retrieve a Passport ticket from the Windows Live service.
LogonManager lm = New LogonManager();
_passportTicket = lm.Logon(_username, _password, _partner, policyResponse.Policy,
_environment);
// Dispose Of the LogonManager Object To avoid a FileNotOpen exception.
lm.Dispose();

String orgUniqueName = "org582c8"

// Retrieve the CrmTicket.
RetrieveCrmTicketRequest crmTicketRequest = New RetrieveCrmTicketRequest();
crmTicketRequest.OrganizationName = orgUniqueName;
crmTicketRequest.PassportTicket = _passportTicket;
RetrieveCrmTicketResponse crmTicketResponse =(RetrieveCrmTicketResponse)discoveryService.Execute(crmTicketRequest);

//Create And configure an instance Of the CrmService Web service.
CrmAuthenticationToken token = New CrmAuthenticationToken();
// For CRM live Set authentication type To 1
token.AuthenticationType = AuthenticationType.Passport;
// We will need CRM Ticket To Get authenticated
token.CrmTicket = crmTicketResponse.CrmTicket;
token.OrganizationName = crmTicketResponse.OrganizationDetail.OrganizationName;

CrmService crmService = New CrmService();
crmService.Url = crmTicketResponse.OrganizationDetail.CrmServiceUrl;
crmService.CrmAuthenticationTokenValue = token;
// Invoke the desired CrmService Web service methods.
lead myLead = New lead();
myLead.lastname = "Rana";
myLead.firstname = "Nishant";
crmService.Create(myLead);

 

 

Bye..


Discover more from Nishant Rana's Weblog

Subscribe to get the latest posts sent to your email.

Unknown's avatar

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

2 thoughts on “Accessing CrmService live or online”

Leave a reply to Rajesh Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Nishant Rana's Weblog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Power Platform Puzzles

D365 CRM, Power Platform Tips &Tricks

Power Spark

Power Spark By Shrangarika

Van Carl Nguyen

Exploration of Power Platform

My Trial

It is my experience timeline.

Power⚡Thomas

Sharing my knowledge and experience about the Microsoft Power Platform.

Arpit Power Guide

a guide to powering up community

Welcome to the Blog of Paul Andrew

Sponsored by Cloud Formations Ltd

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Microsoft Business Applications Ninja!

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog - PPUG.ORG

AI - Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue

The Professional Paraphraser

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

Power Platform Learning

Your Go-To Resource for Power Apps, Power Automate & More

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.