title: Could not change the content type of a Document list item in a document library
body: <p>I'm programatically changing the content type of a document in a document library. But document is getting added with the content type only.</p>
  
  <p>Here is my coding:</p>
  
  <pre><code>SPFile ofile = oweb.GetFile(oweb.Url + '/' + oDocSet.Item.Url + '/' + refName);
  ofile.Item["Content Type"] = octype.Name;
  ofile.Item["Content Type ID"] = octype.Id;
  ofile.Item.Update();
  </code></pre>
  
  <p>when i traced the above coding the content type is getting changed when i assign them to the item but after I update the the item in the last line the content type of the item is getting set to the default content type.</p>