Uploading Files to SharePoint using PowerShellhttp://www.drowningintechnicaldebt.com/GregTate/archive/2014/01/02/uploading-files-to-sharepoint-using-powershell.aspx
Today I had to fall in line and do something I’m not entirely proud of. I had to create a script to replicate files from a fileshare to Sharepoint. Struggling to find value in the efforts, I figured a blog post to remind me of this event was fitting. The script was rather basic, something good, and I took the opportunity to grow, exploring the world of Powershell – SharePoint interaction outside of the SharePoint PS SnapIn. Surprisingly, it was a bit easier than I had imagined. While I wish I could take 100% of the credit, inspiration for this function comes from this article Function Upload-SPFile { Param ( #Local or Network Path [parameter(Mandatory=$true)][string]$UncPath, #SharePoint URL including folder #https://baseurl/serverrelativeurl [parameter(Mandatory=$true)][string]$SPURL ) $UploadPath = $SPURL + $(split-path -Leaf $UncPath) $WebClient = New-Object System.Net.WebClient $WebClient.Credentials = [System.Net.CredentialCache]::DefaultCredentials $WebClient.UploadFile($UploadPath,"Put",$UncPath) } So that’s the basic of uploading a file to SharePoint using the .net webclient…to many this is old hat…To me something new to start out the new year. en-USGreg TateSubtext Version 2.1.2.2Uploading Files to SharePoint using PowerShellhttp://www.drowningintechnicaldebt.com/images/RSS2Image.gifhttp://www.drowningintechnicaldebt.com/GregTate/archive/2014/01/02/uploading-files-to-sharepoint-using-powershell.aspx
7760