Share via


MS-CRM Programming model example

I posted the source over on microsoft.public.crm.developer. At some point I think it'll probably be put in a more permanent location.

Updated 1321 -

Sorry about not getting the context straight here. I usually don't read blogs through RSS so I keep forgetting that the feeds come in little disconnected pieces. Anyway, the code has beed posted to microsoft.public.crm.developer. The original posting talked about different ways to build a programming model on top of MS-CRM. These go back several months now and many of my original rants are long gone. Hopefully this sample and the "documentation" (usually I'm pretty good at writing docs, but this one is painfully short of useful information) will help get a few people off the XML strings and the old-school RPC/Encoded interfaces (Matt Powell, are you listening?).

Comments

  • Anonymous
    February 22, 2005
    Your posting sounds interesting. However the context is a bit vague; Spoil us RSS readers and present links to the original posting and to your newsgroup posting.

    Keep up the good work!
  • Anonymous
    February 23, 2005
    Thank you very much for sample code.
    Unfortunately it doesn't compile for me:

    one of these lines give an error back (here's the first one):
    sp.Id = accessType.securityPrincipal.Value;

    these are all errors:
    c:inetpubwwwrootcrmwebserviceservices.asmx.cs(1674,21): error CS0117: 'string' does not contain a definition for 'Value'
    c:inetpubwwwrootcrmwebserviceservices.asmx.cs(1675,78): error CS0117: 'string' does not contain a definition for 'type'
    c:inetpubwwwrootcrmwebserviceservices.asmx.cs(1916,21): error CS0117: 'string' does not contain a definition for 'Value'
    c:inetpubwwwrootcrmwebserviceservices.asmx.cs(1917,21): error CS0117: 'string' does not contain a definition for 'type'

    by the way, can you explain, what modifications we have to do exactly concerning the CLR 1.1 bug?

    Thank you very much.

    Regards,
    Robert
  • Anonymous
    February 28, 2005
    I think it's because I changed the definition of securityAccessType from a string to a securityPrincipalType. You can either remove the Value and type, or switch over to the securityPrincipalType in the XSD.

    For the other CLR thing just change every instance of Specified to SpecifiedXXX in the generated code.
  • Anonymous
    March 14, 2005
    Thanks for posting this, Mike! I'm expanding on it, and hopefully can send you the code when I'm done. In the meantime, I did notice a problem in the fetch schema. I'm only using v1.2 so maybe that makes a difference, and it might actually work the way you have it (it didn't for me though) but according to the fetch schema posted on msdn, the "attribute" element has no value, but only an attribute named "name". So the schema change would be in the entityType type from this (and hopefully it posts okay here):
    <xsd:complexType name="entityType">
    <xsd:sequence>
    <xsd:choice minOccurs="1" maxOccurs="1">
    <xsd:element name="all-attributes" type="tns:allAttributesType" minOccurs="0" maxOccurs="1" />
    <xsd:element name="attribute" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
    </xsd:choice>
    <xsd:element name="order" type="tns:orderType" minOccurs="0" maxOccurs="unbounded" />
    <xsd:element name="link-entity" type="tns:linkEntityType" minOccurs="0" maxOccurs="1" />
    <xsd:element name="filter" type="tns:filterType" minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="name" use="required" type="xsd:string" />
    </xsd:complexType>

    to this:
    <xsd:complexType name="entityType">
    <xsd:sequence>
    <xsd:choice minOccurs="1" maxOccurs="1">
    <xsd:element name="all-attributes" type="tns:allAttributesType" minOccurs="0" maxOccurs="1" />
    <xsd:element name="attribute" type="tns:attributeType" minOccurs="0" maxOccurs="unbounded" />
    </xsd:choice>
    <xsd:element name="order" type="tns:orderType" minOccurs="0" maxOccurs="unbounded" />
    <xsd:element name="link-entity" type="tns:linkEntityType" minOccurs="0" maxOccurs="1" />
    <xsd:element name="filter" type="tns:filterType" minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="name" use="required" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="attributeType">
    <xsd:attribute name="name" use="required" type="xsd:string" />
    </xsd:complexType>

    Thanks!
  • Anonymous
    March 23, 2005
    Seems to be a small problem in the SQL script. There are 2 references to SecurityPrincipal. One is set to type string, the other is type principlaType. When I changed the XSD to use the principalType for both, it compiled fine.