I already asked this question some days ago but no one answered and I found out what my problem is...
I am creating some folder on a sharepoint server which will be used in order to sort files into them and if I start it it throws and upload error because (when I stop using breakpoints) I see that my mkdir command did not throw any error message but I also didn't work...
EDIT:
I changed mkdir to New-Item -ItemTyoe directory because I thought that works better!
try {
#local file -> called "temporary" which will be created to down- & upload files (without this one the script won't work!!!)
New-Item -ItemType directory -Path $temp_local_file #it will be created on the paritition you entered at the top pf the program
#online files -> those files are created to have the same structure as in the template directory
New-Item -ItemType directory -Path $main_folder
New-Item -ItemType directory -Path $offer_folder
New-Item -ItemType directory -Path $delivery_folder
New-Item -ItemType directory -Path $order_folder
New-Item -ItemType directory -Path $review01_folder
} catch {
Write-Host -f Red "Folder konnten nicht erstellt werden!"
}
And here is the upload:
try {
$webclient.DownloadFile($reviewcomments, $review_download)
$webclient.DownloadFile($internal_project, $internal_project_download)
$webclient.DownloadFile($classification_document, $classification_download)
if($AVBInbox.Text -eq $AVB_languages[1]) {
$webclient.DownloadFile($AVB_en, $AVB_en_download)
Write-Host -f Green "Succesfully downloaded the english AVB"
}
elseif($AVBInbox.Text -eq $AVB_languages[0]) {
$webclient.DownloadFile($AVB_de, $AVB_de_download)
Write-Host -f Green "Succesfully downloaded the german AVB"
} else {
Show-MessageBox -Type Error -Message "An Error happened during the download of the AVB!"
}
} catch {
Write-Host -f Red "File Download failed, please retry!"
Show-MessageBox -Type Error -Message "Download failed please retry!"
}
If anyone has suggestions I would thank him or her :D
You are in SharePoint, (sharepoint 2007 if your tag is correct). So your are not in File system. That's why you have this kind of URL (\workspace\DavWWWRoot........) it use webDAV protocol.
To interact with SharePoint you need do dev a custom .exe (if you are in 2007) and use SharePoint Object Model (for 2007). You can't use PowerShell in SharePoint 2007 (or load the Microsoft.SharePoint.dll in you script, and use Object Model).