Get URL of each video in SharePoint 2013 library with JavaScript - javascript

I need to get the URL of each video in a library with JavaScript (I don't know how many videos will be in the library). I also need to get specific information about each video, such as date created. How would I do this? I am using a Script Editor web part to execute the JavaScript.

You could use rest API to get the information you wanted.
/_api/web/lists/GetByTitle('library title')/files
/_api/web/GetFolderByServerRelativeUrl('/sites/dev/Doc')/Files
Get to know the SharePoint REST service

Rest call with the below url will get you what you looking for
/_api/web/lists/getbytitle('" + youlistname + "')/items?$select=*,FileRef/FileRef"

Related

Call web application from another web application

I need to call a react web application to another javascript web application, I cannot use the iframe or the object, I cannot use the server require, and I don't know the frontend technologies that I will found, then I must use the basically technologies of every application ( javascript or jquery ).
I tried some ways to do it, for example in javascript
qr=new XMLHttpRequest();
qr.open('get',
https://www.mywebapp.com/
,true);
qr.send('c1=v1&c2=v2');
qr.onload=function(){test2.innerHTML=qr.responseText}
and in jquery
var link = "https://mywebapp.com";
var params = "c1=v1&c2=v2"
$("#test").load(
link,
params,
function(){alert("ciao")}
);
});
also in jquery I have tried to use
ajax,ajaxSetup+ajax and other way, in every way i tried to change the value of every parameter like traditional true and false or content-type:'text/html' or every parameter i have found the result of every tried was that I was loaded the page, but the page cannot find the static resources ( javascript, css, images ), I need help
Thank you
Wow, after some clarification it sounds like the chatbot you have written needs to be embedded in to a page in another application. This way the chatbot doesn't know anything about the page it's being embedded on and the embedding page only needs a little bit of script to kick-start the loading of the chatbot.
You'll need to make sure you have JavaScript and CSS that can be downloaded from the chatbot server and dropped in to any page, regardless of which frameworks are in use.
Your JavaScript is then free to grab any other resources (HTML fragment/JavaScript/CSS/Images/etc.) as needed from the chatbot host. This is similar to how you would go about embedding Disqus or Google Maps on to a page.
I think helping implementing this is way out of scope for a single StackOverflow question but hopefully this will give you some idea of what is required and puts you on the right track.

Embed XML/RSS feed into website

I'm trying to embed these pages into my website.
http://globalnews.ca/regina/feed/
http://weather.gc.ca/rss/city/sk-32_e.xml
I'm not sure exactly how these pages are supposed to work. Are these pages only used for scraping data? I'm not sure how to get the information from these XML/RSS feeds?
After some more search I discovered that I need to parse them XML in some fashion. I am using PHP so my first step is to use
simplexml_load_file('http://weather.gc.ca/rss/city/sk-32_e.xml');
and then read it from an array.
Use Google Feed API. It's pretty simple to get to work, and only needs Javascript.
https://developers.google.com/feed/v1/devguide#getting-started

Grabbing a JSON file from a website (specifically Trello.com)

I am trying to grab a JSON file from a website (Trello.com). when I navigate to the web address of the JSON file in IE (or any browser) I am presented with the option to save it or to open it.
So I think to myself "this should be quite easy then".
However I've got some limitations on how to implement it.
I need to display data from the JSON on CRM 2013.
The displaying of the data isn't the issue, it's grabbing the JSON file from the website.
An example URL to use would be https://trello.com/1/boards/dgbi8Gng
I've been trying to use Ajax and JSONP but am encountering issues (likely due to my lack of experience with them).
Could anyone help out a frustrated fellow? Maybe some example code that could be implemented in CRM and a quick explanation?
Many Thanks
You need to include your application key in the url e.g.
https://trello.com/1/boards/dgbi8Gng?key=substitutewithyourapplicationkey
Then it's just a standard request (assuming you're using jQuery)
var url = "https://trello.com/1/boards/dgbi8Gng?key=[YOUR KEY]";
$.getJSON( url, function( data ) {
console.log(data);
});
Full details are here:
https://trello.com/docs/gettingstarted/#getting-an-application-key

Get Image URL from web

I am working on some JavaScript that receives the URL of a page, like fotolog;
http://www.fotolog.com/okendo/18551692/
And I want to search in this website to get the source URL of the image and display it in my website.
I want the URL of the main image but I don't know how.
Thanks in advance.
You can use YQL to fetch the content of the site adn use XPath to pick only the specific node. This all can be done by using AjaxP call.
Here is sample YQL which shows an example for the URL mentioned in your question

Cross Domain Javascript Bookmarklet

I've been at this for several days and searches including here haven't give me any solutions yet.
I am creating a Bookmarklet which is to interact with a POST API. I've gotten most of it working except the most important part; the sending of data from the iframe (I know horrible! If anyone knows a better solution please let me know) to the javascript on my domain (same domain as API so the communication with the API is no problem).
From the page the user clicks on the bookmarklet I need to get the following data to the javascript that is included in the iFrame.
var title = pageData[0].title;
var address = pageData[0].address;
var lastmodified = pageData[0].lastmodified;
var referralurl = pageData[0].referralurl;
I first fixed it with parsing this data as JSON and sending it through the name="" attribute of the iFrame but realized on about 20% of webpages this breaks. I get an access denied; also it's not a very pretty method.
Does anyone have anyidea on how I can solve this. I am not looking to use POSTS that redirect I want it all to be AJAX and as unobtrusive as possible. It's also worth noting I use the jQuery library.
Thank you very much,
Ice
You should look into easyXDM, it's very easy to use. Check out one of the examples on http://consumer.easyxdm.net/current/example/methods.html
After a lot of work I was able to find a solution using JSONP which is enables Cross Domain Javascript. It's very tricky with the Codeigniter Framework because passing data allong the URLs requires a lot of encoding and making sure you dont have illegal characters. Also I'm still looking to see how secure it really is.
If I understand your question correctly, you might have some success by looking into using a Script Tag proxy. This is the standard way to do cross domain AJAX in javascript frameworks like jquery and extjs.
See Jquery AJAX Documentation
If you need to pass data to the iframe, and the iframe is actually including another page, but that other page is on the same domain (a lot of assumptions, I know).
Then the man page code can do this:
DATA_FOR_IFRAME = ({'whatever': 'stuff'});
Then the code on the page included by the iframe can do this:
window.parent.DATA_FOR_IFRAME;
to get at the data :)

Categories

Resources