Easiest way to find file extension from SPFile Object

Hello Reader,

I have moved to new site and here is new article link from where you can post comments/feedback.


Sorry for any inconvenience.



2 Responses

  1. hi,
    good trick but this can also be done with one more way
    recently i was stuck with the same issue and i wanted the filename without extension and not the extension by itself..
    one way was to take the extension and use substring in file name but a tedious way to so..

    so i took the another approach and it was quite simple

    using System.IO;

    string filenamewitoutextension = Path.GetFileNameWithoutExtension(objFile.Name);

    string extension = Path.GetExtension(objFile.Name);

    hope this comes handy…

  2. thanks.it helped me 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: