In order to pass one datatime field to another I do this:
DynamicEntity leadEntity = new DynamicEntity(EntityN开发者_运维百科ame.lead.ToString());
CrmDateTime modifiedby = (CrmDateTime)myImage.Properties["modifiedby"];
CrmDateTimeProperty dtAssignedBy = new CrmDateTimeProperty
(
"new_assignedbyid",
modifiedby
);
leadEntity.Properties.Add(dtAssignedBy);
How do I do the same for lookups? if 'modifiedby' and 'new_assignedbyid' were lookups, how can I pass the chosen value of
The following link has a good overview
http://msdn.microsoft.com/en-us/library/bb959615.aspx
There are two main properties - value and type which must be set for the lookup to be valid.
So you could do something like:
var modifiedby = (Lookup)myImage.Properties["modifiedby"];
var new_modifiedby = new Lookup();
new_modifiedby.value = modifiedby.value;
new_modifiedby.type = modifiedby.type;
Although you could probably just as easily do
var new_modifiedby = (Lookup)myImage.Properties["modifiedby"];
But I haven't verified that one.
精彩评论