Hi
I am creating a small application which stores the new incidents by using
the SDK.
I have added the .dll references of the assemblies
Microsoft.Crm.Platform.Types,
Microsoft.Crm.Platform.proxy and System.Web.Services.
When I execute the code are no error messages, but does not register the
new incident.
This is the code
Thanks,
Gilbert Robinson
the code
=======
Imports Microsoft.Crm.Platform.Proxy
Imports System.web.services
Imports Microsoft.CRM.Flags
Imports Microsoft.CRM.Platform.Types
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
codei() 'Put user code to initialize the page here
End Sub
Sub codei()
' strServer should be set with the name of the platform Web server
Dim strServer As String = "im-dp-flow11"
' virtualDirectory should be set with the name of the Microsoft CRM
' virtual directory on the platform Web server
Dim virtualDirectory As String = "MSCRMServices"
Dim strDir As String = "http://" + strServer + "/" +
virtualDirectory + "/"
' BizUser proxy object
Dim bizUser As New Microsoft.Crm.Platform.Proxy.BizUser
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials
bizUser.Url = strDir + "BizUser.srf"
' CRMIncident proxy object
Dim incident As New Microsoft.Crm.Platform.Proxy.CRMIncident
incident.Credentials = System.Net.CredentialCache.DefaultCredentials
incident.Url = strDir + "CRMIncident.srf"
Dim strErrorMsg As String
Dim strIncidentXml As String
Dim strIncidentId As String
Dim strAccountId As String = "{1BBD7C7F-9ADE-4972-A307-1181A57A5750}"
Dim strCustomerId As String = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}"
Try
Dim userAuth As Microsoft.Crm.Platform.Proxy.CUserAuth =
bizUser.WhoAmI()
' Set up the XML string for the new incident
strIncidentXml = "<incident>"
strIncidentXml += "<title>Incident 1</title>"
strIncidentXml += "<accountid>" + strAccountId + "</accountid>"
strIncidentXml += "<ownerid type=""" +
Microsoft.CRM.Platform.Types.ObjectType.otSystemUser.ToString(+""">")
strIncidentXml += userAuth.UserId + "</ownerid>"
strIncidentXml += "<customerid type=/ " +
Microsoft.CRM.Flags.ObjectType.otSystemUser.ToString() + " / " > " ' "
'ToDo: Error processing original source shown below
'
'
'------------------------------------------^--- Syntax error:
';' expected
strIncidentXml += strCustomerId + "</ownerid>"
strIncidentXml += "</incident>"
' Create an incident
strIncidentId = incident.Create(userAuth, strIncidentXml)
'
'ToDo: Error processing original source shown below
'
'
'-^--- Syntax error: ')' expected
Catch err As System.Web.Services.Protocols.SoapException
' Process the platform error here
strErrorMsg = "ErrorMessage: " + err.Message + " " +
err.Detail.OuterXml + " Source: " + err.Source
Catch err As Exception
' Process other errors here
strErrorMsg = "ErrorMessage: " + err.Message
End Try
End Sub
End Class