Wondering if anyone can help me please, I have a media library with a number of videos in and I want to get the full file name including the extension out of the library, I have so far tried using REST and also using CSOM, here is my REST query:

    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Videos')/items(" + id[ic] + ")",
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
        // Returning the results

    error: function (data) {

I have tried using the uri, the absolute encoded uri, the fileref however I only get back the file name with out the extension, for instance I want: My video.mp4 however I am only getting back My Video

Any help with this would be greatly appreciated!

  • can you post what's in the __metadata part of your data response – Danny '365CSI' Engelman May 9 '16 at 15:27
  • Yes of course, I get the following: '_metadata: Object etag: ""7"" id: "Web/Lists(guid'f419aca5-5c6a-4a5c-bfea-aefc9168f52d')/Items(256)" type: "SP.Data.VideosItem" uri: "sitename/_api/Web/…"' – Adam13Hylo May 9 '16 at 15:35
  • Using CSOM, have you tried including 'FileLeafRef' property? – Aveenav May 9 '16 at 15:38
  • Yes this just returns the file name without the extension unfortunately. – Adam13Hylo May 9 '16 at 15:50

use /_api/web/lists/getbytitle('Videos')/Files and you should be able to get the file name and extension


Try the below REST End point,

_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Videos')/items?files?$filter=Id eq 1&$select=File$expand=File"


_spPageContextInfo.webAbsoluteUrl +"/_api/web/lists/getbytitle('Videos')/getitembyid(1)?$select=File&$expand=File"

Get the file name with extension by accessing Name property and url property by accessing ServerRelativeUrl

  • No sorry either of these seem to work, I have now managed to get the url in CSOM with VideoSetDefaultEncoding, my issue now is that I cant access the array inside of the REST call... – Adam13Hylo May 9 '16 at 17:51

it's worked for me


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.