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

RE: Add new incident from external source with SDK by CasperJ

CasperJ
Wed Feb 22 10:32:29 CST 2006

Are you running on CRM 3.0 or 1.2?

Can't remember if incidents was a part of 1.2...
--
Best regards

Casper Jensen
CRM Extensions
www.crmextensions.com


"Gilbert Robinson" wrote:

> 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
>
>
>
>
>
>
>
>
>

RE: Add new incident from external source with SDK by GilbertRobinson

GilbertRobinson
Wed Feb 22 14:33:26 CST 2006

I am running CRM 1.2 version.

thanks,


"CasperJ" wrote:

> Are you running on CRM 3.0 or 1.2?
>
> Can't remember if incidents was a part of 1.2...
> --
> Best regards
>
> Casper Jensen
> CRM Extensions
> www.crmextensions.com
>
>
> "Gilbert Robinson" wrote:
>
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
> >

Re: Add new incident from external source with SDK by Matt

Matt
Wed Feb 22 16:57:07 CST 2006

Make sure you catch the SOAPException type and look at the
ex.Details.Innerhtml for a more detailed error msg. But, it looks like you
have an issue in your XML. You have the wrong end tag for the CustomerId
node. You should also try logging your XML you are sending to the API so
you can validate it.

--

Matt Parks
MVP - Microsoft CRM


"Gilbert Robinson" <GilbertRobinson@discussions.microsoft.com> wrote in
message news:FED0E4EF-31C2-4429-8FCC-307CCBDB5671@microsoft.com...
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