Using Property Collection in MS CRM 4.0

While using Properties in MS CRM 4.0 one has to be careful as to which dotnet namespace you are instantiating it from. For MS CRM purposes, you need to make sure you instantiate it from Microsoft.crm.sdk and not from System.Data namespace. If you type the following code

PropertyCollection pc_Dummy = new PropertyCollection();

In the above line the word “Property Collection” will be show in Red in the Visual Studio IDE. This can be resolved using the following piece of declaration code.

Microsoft.CRM.sdk.PropertyCollection pc_Dummy = new 
Microsoft.CRM.sdk.PropertyCollection();

we can then use this instance (pc_Dummy) in tandem with the Dynamic Entity to add data in the MS CRM database.

PropertyCollection can add any object of type Property. For our purposes we will add mostly MS CRM based properties like CRMBoolean, CRMNumber, StringProperty and so on. Some of the properties I have worked with are

  1. LookupProperty
  2. KeyProperty
  3. CrmBooleanProperty
  4. StringProperty
  5. CrmDateTimeProperty
  6. CrmDecimalProperty
  7. CrmFloatProperty
  8. CrmNumberProperty
  9. CrmMoneyProperty
  10. PicklistProperty

We have more properties other than the above given list. I will brief it in an another post. I do have an idea to create a new tool for MS CRM 4.0 Data Migration purposes. Once I start giving shape to the tool, you can expect more posts on MS CRM 4.0.

Please do let me know if i have missed something.

Leave a Reply

Your email address will not be published. Required fields are marked *