jeudi 26 février 2015

How to change the content type of a file with .stp (Autocad file) extension?



I need to upload a file with .stp extension to a document library and set a predefined content type to it using server side code. I am able to add the file using SPFileCollection.Add(string fileUrl,byte[] data). This creates the item with default content type. Then I try to set the desired content type using following:



item["ContentTypeId"]= "0x012345"; //this is only example. actual id is not shown here.
item.SystemUpdate();


However, the content type remains unchanged. This works if the file extension is something else (like .pdf or .doc).


How can I add the file with my desired content type?








0 commentaires:

Enregistrer un commentaire