title: Find a specific field on a site and the set it to “Required” in a EventReciever
body: <p>I have created a EventReciever that will be activated when a site gets created. This site have a announcement webpart. When they click on "add announcement", newform.aspx pops up as a dialog and there is a field there that is called Expired I need to make it required, so the field must be used else it prevent the user of adding a announcement.</p>
  
  <p>How can I find that specific field and set it to Required in my EventReciever?</p>
  
  <pre><code>&lt;!-- FieldName="Expires"
               FieldInternalName="Expires"
               FieldType="SPFieldDateTime"
            --&gt;
  </code></pre>
  
  <p>This is how I have progressed so far:</p>
  
  <pre><code>public override void FeatureActivated(SPFeatureReceiverProperties properties)
  {
  
      if (properties.Feature.Parent is SPWeb)
      {
          var web = properties.Feature.Parent as SPWeb;
              var expiredDate = web.Fields.GetFieldByInternalName("Expires");
              expiredDate.Required = true;
              expiredDate.Update();
  
      }
  
  }
  </code></pre>
  
  <p>Any kind of tips or help is appreciated!</p>