[Reflection.Assembly]::LoadFile( `
'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll')`
| out-null
$FileName = "C:\Temp\ImagesURL.txt";
$Loc = "C:\Temp\Images\"
$ImageName = ""
$wc = New-Object System.Net.WebClient
$content = Get-Content $FileName
foreach ($line in $content)
{
$Image = $Loc + $line.Substring($line.LastIndexOf("/") + 1)
$url = $line
Write-Host $url
Write-Host $Image
$wc.DownloadFile($url, $Image)
}
write-host "Finished successfully."
Wednesday, February 18, 2015
PowerShell - Download Images from Web
I had a requirement where I have to export user profile images from MySite 2013 and I end up writing following PowerShell script:
Friday, February 13, 2015
HTTP Request with Javascript
<script type="text/javascript">
var oReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");
function handler()
{
if (oReq.readyState == 4 /* complete */) {
if (oReq.status == 200) {
document.getElementById("myDiv").innerText = oReq.responseText;
}
}
}
function SendRequest()
{
var vURL = "http://IdolApp:12345/data/data.xml";
if (oReq != null) {
oReq.open("GET", vURL, true);
oReq.onreadystatechange = handler;
oReq.send();
}
else {
window.console.log("AJAX (XMLHTTP) not supported.");
}
}
</script>
<input type="button" id="btnSubmit" value="Go" onclick="SendRequest()"/>
<br/>
<div id="myDiv" >:o)</div>
Ref: https://msdn.microsoft.com/en-us/library/ie/ms535874(v=vs.85).aspx
Note:
Initialize the oReq with following to make it IE and Chrome compatible:
var oReq;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
oReq=new XMLHttpRequest();
}
else
{// code for IE6, IE5
oReq=new ActiveXObject("Microsoft.XMLHTTP");
}
Subscribe to:
Posts (Atom)
-
Scenario: Updating the Master Page for SharePoint Online is not recommended by Microsoft now.....fine. So how do we change the UI then? And...
-
Microsoft introduced Office Graph a couple of months back which uses machine learning techniques to connect people to the relevant content,...
-
I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...
Official SharePoint Documentation
I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...