0

right now I have the Url from a video item, that im showing in a Video native webpart, but i need to get the title and description for processing.

For that, I only can use Javascript, so, I get the List ID like this:

function(siteUrl, webUrl, relativeFileUrl, itemResult) {
            var ctx = new SP.ClientContext(siteUrl);
            var site = ctx.get_site();
            var web = site.openWeb(webUrl);         
            var file = web.getFileByServerRelativeUrl(relativeFileUrl);
            var item = file.get_listItemAllFields();            
            var list = item.get_parentList();
            ctx.load(web);
            //ctx.load(item, 'Id');
            ctx.load(item);
            ctx.load(list);
            ctx.executeQueryAsync(
                Function.createDelegate(this, function(sender, args){
                    // success
                    //console.log("Success");               
                    itemResult({  
                        list : list,
                        item : item
                    });
                }), 
                Function.createDelegate(this, function(sender, args) {
                    // error
                    ...
                })
            );
        }

But when i check the sharepoint model, it creates two items for the video types, so the Title and description are associated with a second element, and this function only bring me the first element, that its like a folder, and when you modify the item, you modify its the second element.

There is any way I can get the Title and Description for the video having this item? Or there is maybe other approach for getting it?

Thanks for your help!

  • If I'm understanding this right, you need the actual video stored within the folder. See if this helps: sharepoint.stackexchange.com/questions/114846/… – Akhoy Aug 14 '15 at 5:56
  • Thanks, the info helps, and I'm using now web.getFolderByServerRelativeUrl(relativeFileUrl) and file.get_properties() and with that I get Title and description, but cannot find LikesCount Any idea how i get it? Thanks. – Alejandro Saldarriaga Aug 14 '15 at 14:51
  • Ok, I done it now, it was not a property when the element doesn't have a like. Now You know a way to set a like with this method or other Microsoft.Office.Server.ReputationModel.Reputation.setLike to a folder? – Alejandro Saldarriaga Aug 14 '15 at 16:29
  • Please ask another question for that. It is not related to this question. Added answer for this question. – Akhoy Aug 14 '15 at 16:36
0

Posting comment as answer
If I'm understanding this right, you need the actual video stored within the folder. Video content type is created as a folder in the asset library. You can use getfolderbyserverrelativeurl and get video information from there. See: How to get the full url of video uploaded to asset library SharePoint

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.