Post

Unpublishing SPListItem

In Document Library you can easily take the most current approved or major version offline by calling to method . This is because each of Document Library has a property , a reference to SPFile, which represents the document itself. So no problem here, you have SPListItem, which has a reference to SPFile, which has a method TakeOffine.

Things a little bit different in SPList, which is not a Document Library. Because then a property is null.

In order to get SPFile in this case, you need to get a it from a parent and then to call to the method TakeOffline. Here is the code: