Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 72635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:04:32+00:00 2026-05-10T20:04:32+00:00

I am trying to create a new contact using Dynamic Entity. The sample i

  • 0

I am trying to create a new contact using Dynamic Entity. The sample i found in CRM SDK had this code.

// Set the properties of the contact using property objects.         StringProperty firstname = new StringProperty();         firstname.Name = 'firstname';         firstname.Value = 'Jesper';         StringProperty lastname = new StringProperty();         lastname.Name = 'lastname';         lastname.Value = 'Aaberg';          // Create the DynamicEntity object.         DynamicEntity contactEntity = new DynamicEntity();          // Set the name of the entity type.         contactEntity.Name = EntityName.contact.ToString();          // Set the properties of the contact.         contactEntity.Properties = new Property[] {firstname, lastname}; 

In my code i have the following implementation.

        StringProperty sp_Field1 = new StringProperty('Field1','Value1');         StringProperty sp_Field2 = new StringProperty('Field2','Value1');          CrmService service = new CrmService();         service.Credentials = System.Net.CredentialCache.DefaultCredentials;         // Create the DynamicEntity object.         DynamicEntity contactEntity = new DynamicEntity();         // Set the name of the entity type.         contactEntity.Name = EntityName.contact.ToString();         // Set the properties of the contact.         contactEntity.Properties = new Property[] {sp_Field1,sp_Field2}; 

I don’t see much differences in the code. In the examples i found in the internet i have the same implementation as i found in SDK. But if i run the same i get the following error

CS0029: Cannot implicitly convert type ‘Microsoft.Crm.Sdk.StringProperty’ to ‘Microsoft.Crm.Sdk.PropertyCollection’

I tried created a new variable of type PropertyCollection(one that belongs in mscrm namespace) and added the stringpropertys into that and passed it to the entity.

Microsoft.Crm.Sdk.PropertyCollection propTest = new Microsoft.Crm.Sdk.PropertyCollection();         propTest.Add(sp_SSNNo);         propTest.Add(sp_FirstName);         contactEntity.Properties = new Property[] {propTest}; 

This gave me the following error

CS0029: Cannot implicitly convert type ‘Microsoft.Crm.Sdk.PropertyCollection’ to ‘Microsoft.Crm.Sdk.Property’

I am sure its a minor typecasting error but i am not able to figure out where the error is. And moreover, even if it was a typecasting error why is it working for all the samples given in the internet and not for me. I tried getting the code sample to run but i am encountering the same conversion error. Please let me know if you need more info on this, any help on this would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:04:32+00:00Added an answer on May 10, 2026 at 8:04 pm

    Here is an article from Microsoft that makes an attempt to discuss this topic:

    http://community.dynamics.com/blogs/cscrmblog/archive/2008/06/23/web-services-amp-dlls-or-what-s-up-with-all-the-duplicate-classes.aspx

    This is not a bug that you are running into but more of a difference in design between the way the two assemblies work and what they are designed to do.

    If you want to continue to use the Microsoft.Crm.Sdk.dll you should be able to accomplish your goal with the following…

        StringProperty sp_Field1 = new StringProperty('Field1','Value1');     StringProperty sp_Field2 = new StringProperty('Field2','Value1');      CrmService service = new CrmService();     service.Credentials = System.Net.CredentialCache.DefaultCredentials;     // Create the DynamicEntity object.     DynamicEntity contactEntity = new DynamicEntity();     // Set the name of the entity type.     contactEntity.Name = EntityName.contact.ToString();      // Set the properties of the contact.     PropertyCollection properties = new PropertyCollection();     properties.Add(sp_Field1);     contactEntity.Properties = properties; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've done similar. Try this - using (ChannelsEntities chEntity =… May 11, 2026 at 4:28 pm
  • Editorial Team
    Editorial Team added an answer From a "pattern" standpoint, though, this doesn't seem onerous to… May 11, 2026 at 4:28 pm
  • Editorial Team
    Editorial Team added an answer The expression to handle your example would be \<\!\[CDATA\[(?<text>[^\]]*)\]\]\> Where… May 11, 2026 at 4:28 pm

Related Questions

I am fairly new to the MVC Framework and have spent the last few
I'm trying to digitally sign a PDF file using THIS project as an example.
I'm experimenting with ASP.NET MVC and Routes. It appears MVC forces me to add
I am trying something very simple, but for some reason it does not work.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.