Problem/Error:
When I create an instance of object from the sdk generated
code by using the default constructor like:
email.regardingobjectid = new CrmEntityReference();
I will find it return a null object:
This is not the result I wanted because the object does not
have correct structure and when I try to assign a value to the object (in this
case is regardingobjectid)
it will throw a NullReferenceException error like this:
Solution
The solution is relatively simple by using a different
constructor and it will give a correct object:
email.regardingobjectid = new CrmEntityReference("contact", contact.contactid);
No comments:
Post a Comment