Domanda

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!

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top