SharePoint Asked by Adam13Hylo on November 5, 2021
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:
$.ajax({
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
console.log(data);
},
error: function (data) {
failure(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!
it's worked for me
?$select=ID,Title,Description,FileRef,ContentTypeId,VideoSetDefaultEncoding,ContentType/Name&$expand=ContentType&$top=20000
Answered by Oleg Lysov on November 5, 2021
Try the below REST End point,
_spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Videos')/items?files?$filter=Id eq 1&$select=File$expand=File"
or
_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
Answered by Shantha Kumar Thambidurai on November 5, 2021
use /_api/web/lists/getbytitle('Videos')/Files
and you should be able to get the file name and extension
Answered by Ahmed Mahmoud on November 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP