Pages

Showing posts with label find file extension from SPFile Object. Show all posts
Showing posts with label find file extension from SPFile Object. Show all posts

Friday, May 29, 2009

Easiest way to find file extension from SPFile Object

We can pass SPFile.Name object into FileInfo Class and get the extension of file. It will returns “.ASPX” or “.HTML” file extension depending upon file object.

 Example Code:   

SPFile objFile;

string strFileExtension = new FileInfo(objFile.Name).Extension;