Professional Web Applications Themes

CRM SDK Examples?? - ASP.NET General

Hi Peeps, I am trying to do some custom programming for CRM, but alas i am only a classic asp programmer. Can someone help me by translating this into asp.net in VB instead of C#, i can then get on as i think i am okay with the rest only not too clever with imports etc. This is in the CRM SDK under CRMIncident.Open Method. Thanks In Advance [C#] // server should be set with the name of the platform Web server string server = "myservername"; // virtualDirectory should be set with the name of the Microsoft CRM // Virtual ...

  1. #1

    Default CRM SDK Examples??

    Hi Peeps,
    I am trying to do some custom programming for CRM, but alas i am only a
    classic asp programmer.
    Can someone help me by translating this into asp.net in VB instead of C#, i
    can then get on as i think i am okay with the rest only not too clever with
    imports etc.
    This is in the CRM SDK under CRMIncident.Open Method.

    Thanks In Advance
    [C#]
    // server should be set with the name of the platform Web server
    string server = "myservername";

    // virtualDirectory should be set with the name of the Microsoft CRM
    // Virtual Directory on the platform Web server
    string virtualDirectory = "mscrmservices";
    string strDir = "http://" + server + "/" + virtualDirectory + "/";

    // BizUser proxy object
    Microsoft.CRM.Proxy.BizUser bizUser = new Microsoft.CRM.Proxy.BizUser ();
    bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
    bizUser.Url = strDir + "BizUser.srf";

    // CRMIncident proxy object
    Microsoft.CRM.Proxy.CRMIncident incident = new
    Microsoft.CRM.Proxy.CRMIncident();
    incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
    incident.Url = strDir + "CRMIncident.srf";

    // CRMAccount proxy object
    Microsoft.CRM.Proxy.CRMAccount account = new Microsoft.CRM.Proxy.CRMAccount
    ();
    account.Credentials = System.Net.CredentialCache.DefaultCredentials;
    account.Url = strDir + "CRMAccount.srf";

    string strErrorMsg;
    try
    {
    Microsoft.CRM.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

    // Set up the XML for a new account
    // The required fields are name and ownerid
    string strAccountXml = "<account>";
    strAccountXml += "<name>Account Number 2</name>";
    strAccountXml += "<accountnumber>A01923</accountnumber>";
    strAccountXml += "<websiteurl>www.account1.com</websiteurl>";
    strAccountXml += "<ownerid type=\"" +
    Microsoft.CRM.Flags.ObjectType.otSystemUser.ToStri ng() +"\">";
    strAccountXml += userAuth.UserId + "</ownerid>";
    strAccountXml += "</account>";

    string strAccountId = account.Create(userAuth, strAccountXml);

    // Set up the XML for a new incident
    string strIncidentXml = "<incident>";
    strIncidentXml += "<title>incident 1</title>";
    strIncidentXml += "<accountid>" + strAccountId +"</accountid>";
    strIncidentXml += "<ownerid type=\"" +
    Microsoft.CRM.Flags.ObjectType.otSystemUser.ToStri ng() +"\">";
    strIncidentXml += userAuth.UserId + "</ownerid>";
    strIncidentXml += "</incident>";

    // Create an incident
    string strIncidentId = incident.Create(userAuth, strIncidentXml);

    // Now open the incident
    incident.Open(userAuth, strIncidentId, -1);

    }
    catch (System.Web.Services.Protocols.SoapException err)
    {
    // Process the platform error here
    strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml
    + " Source: " + err.Source );
    }
    catch (Exception err)
    {
    // Process other errors here
    strErrorMsg = ("ErrorMessage: " + err.Message );
    }



    Phil Guest

  2. #2

    Default Re: CRM SDK Examples??

    Few pointers

    1) Remove all ; ';'

    2) Change + to &

    3) when declaring a variable
    C#: string virtualDirectory = "mscrmservices";
    VB.NET: Dim virtualDirectory as String = "mscrmservices"

    4) C#: strAccountXml += "<name>Account Number 2</name>";
    this means strAccountXml = strAccountXml +
    "<name>Account Number 2</name>"

    "Phil Adams" <co.uk> wrote in message
    news:%phx.gbl... 


    with 
    Microsoft.CRM.Proxy.CRMAccount 
    err.Detail.OuterXml 


    MS Guest

  3. #3

    Default Re: CRM SDK Examples??

    This is different, you have put some statics
    dim strAccountId as string = "{38A03BA8-7C0B-487F-836D-9DAD2A64B0D2}"
    where is it failing, what error? do you get?, did you debug

    I am not familiar with this.
    just a question: in the strAccountId do you have to have the '{' and '}'

    "Phil Adams" <co.uk> wrote in message
    news:%phx.gbl... 
    it 

    "<contractdetailid>{01F3DB31-834E-40DD-8E8A-E66493466AE3}</contractdetailid> 


    MS Guest

  4. #4

    Default Re: CRM SDK Examples??

    http://www.microsoft.com/BusinessSolutions/Microsoft%20Customer%20Relationship%20Management/MSCRM/default.mspx
    Above is link to CRM, It is Microsofts attempt to join the CRM/ERP
    bandwagon.
    Although at the moment it is v1.0 and not avail outside the USA, It is far
    the best system i have seen.
    the SDK PDF is Attached maybe of help???

    WBR
    Phil Adams

    "MS News (MS ILM)" <com> wrote in message
    news:%phx.gbl... 

    > own 
    > the 
    > previously 
    > uses [/ref][/ref]
    '}' 
    > > reason 
    > > virtualDirectory 
    > > "{38A03BA8-7C0B-487F-836D-9DAD2A64B0D2}" 
    > > Microsoft.CRM.Proxy.BizUser [/ref]
    > System.Net.CredentialCache.DefaultCredentials [/ref]
    > System.Net.CredentialCache.DefaultCredentials [/ref][/ref]
    1</title>" [/ref][/ref]
    strAccountId [/ref]
    > "</ownerid>" [/ref]
    > "<statuscode>15</statuscode>" 
    > >[/ref]
    >[/ref]
    "<contractdetailid>{01F3DB31-834E-40DD-8E8A-E66493466AE3}</contractdetailid> 
    > >
    > >[/ref]
    >
    >[/ref]



    Phil Guest

  5. #5

    Default Re: CRM SDK Examples??


    did you add the porper References and Imports
    Project menu - Add References etc..


    "Phil Adams" <co.uk> wrote in message
    news:%phx.gbl... 


    MS Guest

  6. #6

    Default Re: CRM SDK Examples??

    If you are translating this into VB.Net then you don't have to worry about
    numbers 2 and 4. The '+' sign works for strings in VB.Net just like it does
    in C# and VB.Net also supports the += operator. If you are converting this
    to a standard ASP 3.0 page then you will need to perform numbers 2 and 4.
    Good luck. Ken.

    "MS News (MS ILM)" <com> wrote in message
    news:phx.gbl... [/ref]
    only [/ref]
    C#, 
    > with [/ref]
    (); 
    > Microsoft.CRM.Proxy.CRMAccount 
    > err.Detail.OuterXml 
    >
    >[/ref]


    Ken Guest

Similar Threads

  1. Using examples
    By flashste in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 18th, 12:08 PM
  2. Examples for Feb CTP
    By Angel \Java\ Lopez in forum Windows Vista
    Replies: 3
    Last Post: March 9th, 12:26 PM
  3. [PHP-DEV] DOM Examples?
    By Ken in forum PHP Development
    Replies: 2
    Last Post: January 8th, 06:18 AM
  4. learning examples
    By Sam in forum PERL Miscellaneous
    Replies: 4
    Last Post: September 4th, 12:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139