Retrieving lead record from CRM 3.0

G

Guest

Very new to this but using the MS working with dynamics CRM 3.0 book to run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk' does not
exist in the class or namespace 'WorkingWithCrm' (are you missing an assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed in to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(), leadId, cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
C

Claes Bergefall

I don't have the book so I have no idea what steps it details before the
code you posted but I would guess that you forgot to add a reference to the
CRM web service (or you named it something else than CrmSdk). Also verify
that the address to your crm server is indeed http://crm as the service.Url
line indicates

/claes
 
G

Guest

Claes,

Cheers for that we found that some how CrmSdk had been changed to all lower
case within visual 2003. All seems to run without errors however the page
produced by internet explorer has no data in it.

Any further ideas.

Roy

Claes Bergefall said:
I don't have the book so I have no idea what steps it details before the
code you posted but I would guess that you forgot to add a reference to the
CRM web service (or you named it something else than CrmSdk). Also verify
that the address to your crm server is indeed http://crm as the service.Url
line indicates

/claes

rfinch said:
Very new to this but using the MS working with dynamics CRM 3.0 book to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk' does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed in to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(), leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
C

Claes Bergefall

The code looks correct to me. Are you sure that the GUID is correct (does
http://crm/sfa/leads/edit.aspx?id={2EFAB039-2543-428E-95B8-10EA13D58198}
work)? Do you get any exception?

/claes

rfinch said:
Claes,

Cheers for that we found that some how CrmSdk had been changed to all
lower
case within visual 2003. All seems to run without errors however the page
produced by internet explorer has no data in it.

Any further ideas.

Roy

Claes Bergefall said:
I don't have the book so I have no idea what steps it details before the
code you posted but I would guess that you forgot to add a reference to
the
CRM web service (or you named it something else than CrmSdk). Also verify
that the address to your crm server is indeed http://crm as the
service.Url
line indicates

/claes

rfinch said:
Very new to this but using the MS working with dynamics CRM 3.0 book to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk'
does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed in
to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(), leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
G

Guest

Claes,

Hmm interesting the url returns the following;

The record that you are requesting is currently unavailable. Either the
record was not found or you do not have sufficent security permissions to
view it.

I was under the impression from the book that I am using a default record GUID

Have changed the URL to a GUID from the Database and now it shows the
record, however once I run the whole thing asd a web app I still see a blank
page?

So one thing at a time any more good sugestions like the last?

Roy

Claes Bergefall said:
The code looks correct to me. Are you sure that the GUID is correct (does
http://crm/sfa/leads/edit.aspx?id={2EFAB039-2543-428E-95B8-10EA13D58198}
work)? Do you get any exception?

/claes

rfinch said:
Claes,

Cheers for that we found that some how CrmSdk had been changed to all
lower
case within visual 2003. All seems to run without errors however the page
produced by internet explorer has no data in it.

Any further ideas.

Roy

Claes Bergefall said:
I don't have the book so I have no idea what steps it details before the
code you posted but I would guess that you forgot to add a reference to
the
CRM web service (or you named it something else than CrmSdk). Also verify
that the address to your crm server is indeed http://crm as the
service.Url
line indicates

/claes

Very new to this but using the MS working with dynamics CRM 3.0 book to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk'
does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed in
to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(), leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
C

Claes Bergefall

As far as I know there are no default GUIDs, they are unique in every
installation so you must find one that exists on your system.

You need to start debugging and see if you get a lead or if there are any
exceptions thrown. Also verify that you have permissions to work with lead
records.

/claes

rfinch said:
Claes,

Hmm interesting the url returns the following;

The record that you are requesting is currently unavailable. Either the
record was not found or you do not have sufficent security permissions to
view it.

I was under the impression from the book that I am using a default record
GUID

Have changed the URL to a GUID from the Database and now it shows the
record, however once I run the whole thing asd a web app I still see a
blank
page?

So one thing at a time any more good sugestions like the last?

Roy

Claes Bergefall said:
The code looks correct to me. Are you sure that the GUID is correct (does
http://crm/sfa/leads/edit.aspx?id={2EFAB039-2543-428E-95B8-10EA13D58198}
work)? Do you get any exception?

/claes

rfinch said:
Claes,

Cheers for that we found that some how CrmSdk had been changed to all
lower
case within visual 2003. All seems to run without errors however the
page
produced by internet explorer has no data in it.

Any further ideas.

Roy

:

I don't have the book so I have no idea what steps it details before
the
code you posted but I would guess that you forgot to add a reference
to
the
CRM web service (or you named it something else than CrmSdk). Also
verify
that the address to your crm server is indeed http://crm as the
service.Url
line indicates

/claes

Very new to this but using the MS working with dynamics CRM 3.0 book
to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk'
does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed
in
to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(),
leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
G

Guest

Hi Claes,

Thank for the input, however.

Yes sussed that one out, ref GUID went directly to the CRM database and
found a VALID leadId GUID.

Confirmed that this worked by entering the whole url into a browser.
http://crm/sfa/leads/edit.aspx?id={dc5ed1f4-cb47-db11-935f-009027289cc8}
This returned the correct record within the web browser.
However when this was used within the .Net app script the browser still
returned no data
I presume that as the url when entered into the browser directly returned
the correct record I must have the correct permissions to access this data.

Running debug from within visual brings up the web browser the web browser
informs you that the web page has been found, then states done but still
shows no data.

The result of the debug is as follows;

------ Build started: Project: WorkingWithCrm, Configuration: Debug .NET
------

Preparing resources...
Updating references...
Performing main compilation...

Build complete -- 0 errors, 0 warnings
Building satellite assemblies...



---------------------- Done ----------------------

Build: 1 succeeded, 0 failed, 0 skipped



Debug

Auto-attach to process '[2372] w3wp.exe' on machine 'TEST-EX' succeeded.
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No
symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.directoryservices\1.0.5000.0__b03f5f7f11d50a3a\system.directoryservices.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.messaging\1.0.5000.0__b03f5f7f11d50a3a\system.messaging.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.serviceprocess\1.0.5000.0__b03f5f7f11d50a3a\system.serviceprocess.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.web.regularexpressions\1.0.5000.0__b03f5f7f11d50a3a\system.web.regularexpressions.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No
symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.directoryservices\1.0.5000.0__b03f5f7f11d50a3a\system.directoryservices.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.regularexpressions\1.0.5000.0__b03f5f7f11d50a3a\system.web.regularexpressions.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\zjmt2wwi.dll', Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\gy8kwiyh.dll', Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.ui.mobilecontrols.adapters\1.1.0.0__b03f5f7f11d50a3a\system.web.ui.mobilecontrols.adapters.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll', No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\assembly\dl2\e69cb531\d0c67c78_77f7c601\workingwithcrm.dll', Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\zlmyg5ey.dll', Symbols loaded.
The program '[2372] w3wp.exe:
/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000' has exited with code 0
(0x0).
The program '[2372] w3wp.exe: DefaultDomain' has exited with code 0 (0x0).

So where do I go from here? Any suggestions?



Claes Bergefall said:
As far as I know there are no default GUIDs, they are unique in every
installation so you must find one that exists on your system.

You need to start debugging and see if you get a lead or if there are any
exceptions thrown. Also verify that you have permissions to work with lead
records.

/claes

rfinch said:
Claes,

Hmm interesting the url returns the following;

The record that you are requesting is currently unavailable. Either the
record was not found or you do not have sufficent security permissions to
view it.

I was under the impression from the book that I am using a default record
GUID

Have changed the URL to a GUID from the Database and now it shows the
record, however once I run the whole thing asd a web app I still see a
blank
page?

So one thing at a time any more good sugestions like the last?

Roy

Claes Bergefall said:
The code looks correct to me. Are you sure that the GUID is correct (does
http://crm/sfa/leads/edit.aspx?id={2EFAB039-2543-428E-95B8-10EA13D58198}
work)? Do you get any exception?

/claes

Claes,

Cheers for that we found that some how CrmSdk had been changed to all
lower
case within visual 2003. All seems to run without errors however the
page
produced by internet explorer has no data in it.

Any further ideas.

Roy

:

I don't have the book so I have no idea what steps it details before
the
code you posted but I would guess that you forgot to add a reference
to
the
CRM web service (or you named it something else than CrmSdk). Also
verify
that the address to your crm server is indeed http://crm as the
service.Url
line indicates

/claes

Very new to this but using the MS working with dynamics CRM 3.0 book
to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name 'CrmSdk'
does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be passed
in
to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname", "lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(),
leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
C

Claes Bergefall

Set a break point on the line where you retreive the lead from CRM and
verify that you actually get something. Then examine the oLead object in a
watch window and see what it contains. You still haven't answered if you get
any exceptions. Move everything out of the try...catch block and see if it
blows up somewhere and, if so, what exception you get. Also examine the
source of the web page when it looks like it's done

/claes


rfinch said:
Hi Claes,

Thank for the input, however.

Yes sussed that one out, ref GUID went directly to the CRM database and
found a VALID leadId GUID.

Confirmed that this worked by entering the whole url into a browser.
http://crm/sfa/leads/edit.aspx?id={dc5ed1f4-cb47-db11-935f-009027289cc8}
This returned the correct record within the web browser.
However when this was used within the .Net app script the browser still
returned no data
I presume that as the url when entered into the browser directly returned
the correct record I must have the correct permissions to access this
data.

Running debug from within visual brings up the web browser the web browser
informs you that the web page has been found, then states done but still
shows no data.

The result of the debug is as follows;

------ Build started: Project: WorkingWithCrm, Configuration: Debug .NET
------

Preparing resources...
Updating references...
Performing main compilation...

Build complete -- 0 errors, 0 warnings
Building satellite assemblies...



---------------------- Done ----------------------

Build: 1 succeeded, 0 failed, 0 skipped



Debug

Auto-attach to process '[2372] w3wp.exe' on machine 'TEST-EX' succeeded.
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll',
No
symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.directoryservices\1.0.5000.0__b03f5f7f11d50a3a\system.directoryservices.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.messaging\1.0.5000.0__b03f5f7f11d50a3a\system.messaging.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.serviceprocess\1.0.5000.0__b03f5f7f11d50a3a\system.serviceprocess.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll',
No symbols loaded.
'DefaultDomain': Loaded
'c:\windows\assembly\gac\system.web.regularexpressions\1.0.5000.0__b03f5f7f11d50a3a\system.web.regularexpressions.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll',
No
symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.directoryservices\1.0.5000.0__b03f5f7f11d50a3a\system.directoryservices.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.regularexpressions\1.0.5000.0__b03f5f7f11d50a3a\system.web.regularexpressions.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\zjmt2wwi.dll', Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\gy8kwiyh.dll', Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.ui.mobilecontrols.adapters\1.1.0.0__b03f5f7f11d50a3a\system.web.ui.mobilecontrols.adapters.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll',
No symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\assembly\dl2\e69cb531\d0c67c78_77f7c601\workingwithcrm.dll',
Symbols loaded.
'/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
files\workingwithcrm\1947fd5e\251b7787\zlmyg5ey.dll', Symbols loaded.
The program '[2372] w3wp.exe:
/LM/w3svc/1/root/WorkingWithCrm-2-128061695924375000' has exited with code
0
(0x0).
The program '[2372] w3wp.exe: DefaultDomain' has exited with code 0 (0x0).

So where do I go from here? Any suggestions?



Claes Bergefall said:
As far as I know there are no default GUIDs, they are unique in every
installation so you must find one that exists on your system.

You need to start debugging and see if you get a lead or if there are any
exceptions thrown. Also verify that you have permissions to work with
lead
records.

/claes

rfinch said:
Claes,

Hmm interesting the url returns the following;

The record that you are requesting is currently unavailable. Either the
record was not found or you do not have sufficent security permissions
to
view it.

I was under the impression from the book that I am using a default
record
GUID

Have changed the URL to a GUID from the Database and now it shows the
record, however once I run the whole thing asd a web app I still see a
blank
page?

So one thing at a time any more good sugestions like the last?

Roy

:

The code looks correct to me. Are you sure that the GUID is correct
(does
http://crm/sfa/leads/edit.aspx?id={2EFAB039-2543-428E-95B8-10EA13D58198}
work)? Do you get any exception?

/claes

Claes,

Cheers for that we found that some how CrmSdk had been changed to
all
lower
case within visual 2003. All seems to run without errors however the
page
produced by internet explorer has no data in it.

Any further ideas.

Roy

:

I don't have the book so I have no idea what steps it details
before
the
code you posted but I would guess that you forgot to add a
reference
to
the
CRM web service (or you named it something else than CrmSdk). Also
verify
that the address to your crm server is indeed http://crm as the
service.Url
line indicates

/claes

Very new to this but using the MS working with dynamics CRM 3.0
book
to
run
web application to retrieve lead records from CRM 3.0.
Have followed the book instructions on page 380-382.

But am getting the following in ie 7.

Compiler Error Message: CS0234: The type or namespace name
'CrmSdk'
does
not
exist in the class or namespace 'WorkingWithCrm' (are you missing
an
assembly
reference?)

A copy of the code is below.

<%@ Page language="c#" %>
<%@ Import Namespace="WorkingWithCrm.CrmSdk" %>

<!DOCTYPE HTML PUBLIC "-//W3C//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

<script runat="server">

protected void page_Loaded(object sender, EventArgs e)
{
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials =
System.Net.CredentialCache.DefaultCredentials;
service.Url = "http://crm/mscrmservices/2006/crmservice.asmx";


// we are using a known lead GUID. In practrice, this will be
passed
in
to
your routines.
Guid leadId = new Guid("2EFAB039-2543-428E-95B8-10EA13D58198");

// Set the columns to return.
ColumnSet Cols = new ColumnSet();
cols.Attributes = new string [] {"subject", "firstname",
"lastname",
"industrycode"};

try
{
//retrieve the record, casting it as the entity.
lead oLead = (lead)service.retrieve(EntityName.lead.ToString(),
leadId,
cols);

// Display the results.
// Since we have strongly typed the responce, we can just access
the
properties of our object.
Response.Write("Topic: " + oLead.subject + "<br>");
Response.Write("First Name: " + oLead.firstname + "<br>");
Response.Write("Last Name: " + oLead.lastname + "<br>");
Response.Write("Industr: " + oLead.industrycode + "<br>");
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Handle error.
}
}
</script>

<html>
<head runat="server" id="Head1">
<title>Retrieve Lead</title>
<Style>body { font-family:Tahoma;font-size:9pt; }</Style>
</head>
<form id="crmForm" runat="server">
</form>
</body>
</html>


Any advice would be much appreciated.
 
Top