I would like to automate the copying of report files (.xsl) into sharepoint. Does someone have a script that will do this (preferably windows cmd or powershell).
Thanks
Ron
Technology Tips and News
I would like to automate the copying of report files (.xsl) into sharepoint. Does someone have a script that will do this (preferably windows cmd or powershell).
Thanks
Ron
Here's a PowerShell script to upload files:
# Set a few variables $file = "C:\test\myTestFile.txt" $webUrl = "http://server/sites/yoursite" $library = "Team Documents" $overWriteExisting = $True #or add new version if versioning enabled # do a little SharePoint setup $web = Get-SPWeb $webUrl $files = $web.GetFolder($library).Files $fileNameForLibrary = $file.Substring($file.LastIndexOf("\")+1) # read the file $data = Get-ChildItem $file # add any needed metadata $metadata = @{ "Project ID" = "A-200"; "Region" = "North" } # or if no metadata needed: $metadata = @{} # do the upload (the following is one line) $newfile = $files.Add($library + "/" + $fileNameForLibrary, $data.OpenRead(), $metadata, $overWriteExisting)