-
Jan 25th, 2025, 10:02 AM
#1
Thread Starter
Junior Member
VS2022 CRM v8.3 on premises Early & late bound classes
I'm trying to build a simple web application project which connects to an on premises development CRM version 8.3 for reading records, without having to use an expensive 3 party product. Currently I have been looking at a few tutorials, but they are in in C.
I'm eventually looking to expand the project, but just need to get the basics covered first
This is all inhouse and there is no ADFS connection to the development CRM server.
Can anyone point me in the direction of a walk through or tutorial in vb.
-
Jan 25th, 2025, 02:14 PM
#2
Re: VS2022 CRM v8.3 on premises Early & late bound classes
I saw this C to VB converter https://www.codeconvert.ai/c-to-vb.net-converter
Never used it so I don't know if it works.
If not then post the C code and maybe someone here can help you convert it.
-
Jan 25th, 2025, 02:34 PM
#3
Thread Starter
Junior Member
Re: VS2022 CRM v8.3 on premises Early & late bound classes
 Originally Posted by wes4dbt
Hi ,
I don't think the conversion is the issue. I think its more to do with the version of .net , but I'm not sure. I was following the walkthrough https://learn.microsoft.com/en-us/pr...ectedfrom=MSDN
when trying to run it I get
Server Error in '/' Application.
Could not load type 'Xrm.XrmServiceContext'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Could not load type 'Xrm.XrmServiceContext'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Could not load type 'Xrm.XrmServiceContext'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +382
System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +102
[InvalidOperationException: Could not find the type specified in the ContextTypeName property of LinqDataSource 'Contacts'.]
System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +431
System.Web.UI.WebControls.LinqDataSourceView.CreateContextAndTable(DataSourceOperation operation) +1087
System.Web.UI.WebControls.LinqDataSourceView.CreateContextAndTableForSelect() +186
System.Web.UI.WebControls.ContextDataSourceView.GetSource(QueryContext context) +30
System.Web.UI.WebControls.LinqDataSourceView.GetSource(QueryContext context) +359
System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +81
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +22
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +134
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +107
System.Web.UI.Control.EnsureChildControls() +130
System.Web.UI.Control.PreRenderRecursiveInternal() +66
System.Web.UI.Control.PreRenderRecursiveInternal() +297
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7474
-
Jan 27th, 2025, 10:56 AM
#4
Thread Starter
Junior Member
Re: VS2022 CRM v8.3 on premises Early & late bound classes
This isn't pretty, but I am only testing. I've has a little success and managed to retrieve records from D365 (on premises), with X returning the correct number of records
Function Index() As ActionResult
Dim crmUrl = New Uri("http://VS-CRM:5555/VSCRM")
Dim clientCredentials As ClientCredentials = New ClientCredentials()
clientCredentials.UserName.UserName = "MyName"
clientCredentials.UserName.Password = "MyPassword"
Dim service = New OrganizationServiceProxy(New Uri("http://MyCRM/XRMServices/2011/Organization.svc"), Nothing, clientCredentials, Nothing)
Dim userid As Guid = (CType(service.Execute(New WhoAmIRequest()), WhoAmIResponse)).UserId
If userid <> Guid.Empty Then
MsgBox("Connection Established Successfully...")
Else
MsgBox("Failed to Established Connection!!!")
End If
Dim query = New QueryExpression("contact")
query.ColumnSet = New ColumnSet("fullname")
Dim contact = service.RetrieveMultiple(query)
Dim nameslist = From na In contact.Entities
Dim X = nameslist.Count
Return View(nameslist.ToList)
End Function
Model
Public Class contact
Public Property fullname As String
End Class
The issue I am facing is trying to get that data into a MCV List view
-
Jan 27th, 2025, 11:47 AM
#5
Re: VS2022 CRM v8.3 on premises Early & late bound classes
Not a Dynamics person so take this advice with a healthy bit of scepticism...
Rather than going through COM there is a REST API https://learn.microsoft.com/en-us/dy...es?view=op-9-1 that might work better.
Also https://www.nuget.org/packages?q=dyn...rtby=relevance shows a lot of potentially useful nuget packages, they might make it easier to work with .Net and Dynamics.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|