thespot4sap.com independent sap information
 

get SAP Access - pay monthly

SAP Tutorials    Online SAP Training    SAP CBT's    SAP Forums    SAP Articles    SAP Jobs    SAP Resumes
  SAP Access    SAP Blogs    SAP Books     Links     SAP Vendor Directory     Submit Content    Search
Previous posts in SAP CRM
Page 1444 of 5660

Using Powershell and Dynamics CRM

Blogger : MSDN Blogs
All posts : All posts by MSDN Blogs
Category : SAP CRM
Blogged date : 2007 Dec 03

If you want to use Dynamics CRM Web Service with Powershell and be able to Create, Update, Extract Data …

You have simply to create an assembly with wsdl utility and load it in Powershell.

Let’s try:

Make sure that you have access to Csharp compiler, for example by launching first cmd from Visual Studio command prompt menu.

Type

wsdl “http://<your servername>/MSCRMServices/2007/CrmService.asmx

This will create a file called CrmService.csc

Compile the file:

csc /target:library CrmService.csc

Launch Powershell

powershell

Load the dll

 $currentpath = pwd

 [void][System.Reflection.Assembly]::LoadFile([System.IO.Path]::Combine($currentPath,"CrmService.dll"))

Create CrmService Object

 $Crm = new-object "CrmService"

Connect to Crm Server

 $token = new-object CrmAuthenticationToken

 $tokenAuthenticationType=0

 $Token.OrganizationName = "<your business unit name>" # for example “CRMVPC” if you user RC0 VPC 4.0

 $Crm.Url = "http://<your servername>/MSCRMServices/2007/CrmService.asmx"

 $Crm.CrmAuthenticationTokenValue = $token

 $CrmCredentials = [System.Net.CredentialCache].DefaultCredentials

 For the rest just use SDK Documentation

For example:

$contact = new-object "contact"

 $contact.lastname = "Smith"

 $id = $Crm.Create($contact)

If you type $id you must get the GUID created by CRM – Check now that the contact has been created in CRM.

If you have any question contact me xcourchi@microsoft.com.

Enjoy CRM 4.0 and Powershell !!!

 

 


Read comments or post a reply to : Using Powershell and Dynamics CRM
Page 1444 of 5660

Newest posts
New Page 1

 

 

About Us   Contact Us   Privacy   Disclaimer   Feedback   Email Discussion   Newsletter  

Copyright © - Independent SAP Information
Learn XML, Guesthouses and B&B's