title: Get data from to field in new activity in CRM 2011
body: <p>I create a new plugin for dynamic CRM 2011 for a costume Activity Entity.</p>
  
  <p>this new activity have "to" field like Email and some other activities. </p>
  
  <p>plugin are working on Create and Update steps for activity.</p>
  
  <p>my problem is when i want to get <code>"to"</code> field value the below line of code return false value and i don't know what i have done. in fact i can fetch other custom field and just the <code>"to"</code> field does not work.</p>
  
  <pre><code>if (entity3.Attributes.Contains("to"))
  </code></pre>
  
  <p>and this is whole code:</p>
  
  <pre><code>public void Execute(IServiceProvider serviceProvider)
  {
      if (serviceProvider == null)
      {
          throw new ArgumentNullException("serviceProvider");
      }
  
      IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
      if (context.InputParameters.Contains("Target") &amp;&amp; (context.InputParameters["Target"] is Entity))
      {
              Entity entity2 = (Entity)context.InputParameters["Target"];
              if (entity2.LogicalName == "EntityAtivity")
              {
                  QueryExpression expression3 = new QueryExpression("EntityAtivity");
                  ColumnSet set2 = new ColumnSet();
                  set2.AllColumns = true;
                  expression3.ColumnSet = set2;
                  ConditionExpression item = new ConditionExpression();
                  item.AttributeName = "activityid";
                  CurrentGuid = (Guid)entity2.Attributes["activityid"];
                  item.Values.Add(this.CurrentGuid);
                  FilterExpression expression5 = new FilterExpression();
                  expression5.Conditions.Add(item);
                  expression3.Criteria = expression5;
                  EntityCollection entitys2 = service.RetrieveMultiple(expression3);
                  foreach (Entity entity3 in entitys2.Entities)
                  {
                      this.dbGuid = (Guid)entity3.Attributes["activityid"];
                      if (entity3.Attributes.Contains("to"))
                      {
                          try
                          {
                              foreach (Entity entity10 in ((EntityCollection)entity3.Attributes["to"]).Entities)
                              {
                                  this.dbTo.Add(((EntityReference)entity10.Attributes["partyid"]).LogicalName);
                                  this.dbToId.Add(((EntityReference)entity10.Attributes["partyid"]).Id);
                              }
                          }
                          catch (Exception)
                          {
                              this.dbTo.Clear();
                          }
                      }
                  } // foreach
              }//if (entity2.LogicalName == "EntityAtivity")
      }//if (context.InputParameters.Contains("Target") &amp;&amp; (context.InputParameters["Target"] is Entity))
  }
  </code></pre>
  
  <p>any know what i should done to correct plugin?</p>