A quickie.
Heres 4 lines of code to upload a whole directory of files, in this case pictures, to a SharePoint document or image library.
The directory pictures contains the images.
The destination is the image library SiteCollectionImages for the portal running on port 2828
$wc = new-object System.Net.WebClient$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentialsfunction getdestname($filename){ "http://sps:2828/sitecollectionimages/" + $(split-path -leaf $filename)}dir "pictures" | % { $uploadname=getdestname $_; $wc.UploadFile($uploadname,"PUT", $_.FullName) }
Have I mentioned PowerShell just rocks?
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2009, Colin Byrne
E-mail