I'm trying to upload some files to SharePoint 2013 document library using PowerShell and SharePoint 2013 web services (/_vti_bin/copy.asmx). There is some examples how to use copy.asmx web service on C# like this but I want to do this with powershell. How can I do this? How can I use /_vti_bin/copy.asmx web services from PowerShell?
I will upload files to a SharePoint farm which is not in our domain so I need to set username and password.
Thanks in advance.
Update:
I've solved my problem to upload file with following code; but I couldn't set the meta data fields of document.
$URI = "http://www.example.com/sites/dev/_vti_bin/copy.asmx?WSDL"
$securePasssword = ConvertTo-SecureString "password" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ("xyz\username", $securePasssword)
$proxy = New-WebServiceProxy -Uri $URI -Namespace ILS -Credential $credentials
$data = [IO.File]::ReadAllBytes("C:\Users\user\Desktop\TestDoc.pdf")
$fields =@()
$field = New-Object -TypeName ILS.FieldInformation
$field.DisplayName="Disp"
$field.InternalName="Title"
$field.Value="t.pdf"
$fields+=$field
$date1 = Get-Date -Format "yyyyMMddHHmmss"
$results = $null
$proxy.CopyIntoItems(" ","http://www.example.com/sites/Dev/TestLib/TestDoc_$date1.pdf", [ILS.FieldInformation]$fields,$data,[ref] $results)
It gives me following error