title: SPUtility.CreateNewDiscussionReply creates a Discussion item
body: <p>I have a very estrange error, in one of my <strong>SharePoint</strong> farms when I call <code>SPUtility.CreateNewDiscussionReply()</code>, it creates a new item filled with the values of the reply but with a Discussion content type. However, if I reply from web, it creates a discussion reply item correctly.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Debugging more deeper I found that the SPUtility.CreateNewDiscussionReply() sets the item contenttype to "Message" but not the ContentTypeId. When the item is added SharePoint have some problem to find the Message content type and resolves with the first content type found in the list.</p>
  
  <p>This is the code I use to test this issue:</p>
  
  <pre><code>SPList list = web.Lists["Discussions"];
  SPListItem discussion = list.GetItemById(11);
  
  SPListItem reply = SPUtility.CreateNewDiscussionReply(discussion);
  // At this point:
  //   reply["ContentType"] = "Message"
  //   reply["ContentTypeId"] = ""
  
  reply["Body"] = "This is a test reply";
  
  reply.Update();
  // At this point:
  //   reply["ContentType"] = "Message"
  //   reply["ContentTypeId"] = "0x012002...." (Discussion content type)
  </code></pre>
  
  <p><strong>Workaround:</strong>
  I found that if I set the content type id of the reply manually before update the item all works correctly:</p>
  
  <pre><code>reply["ContentTypeId"] = list.ContentTypes.BestMatch(SPBuiltInContentTypes.Message);
  </code></pre>