Import-PWDocuments usage. "Valid default storage area OR ProjectWise folder path must be provided"

I am trying to use the Import-PWDocuments cmdlet to create/update documents (pwps_dab 

I simply want to import all the content of a folder on my local drive to an existing folder in ProjectWise.

The first time, if the document does not exist, it should be created in PW. If it exists, if should be updated. No version is needed here, a simple overwrite will do.

Take this example:

FROM: C:\Temp\Samples\ImportFrom\

TO:      pw:\\<server:datasource>\Documents\Test-Project\Samples\

After connecting to the datasource, the script looks like:

$inputFolder = "C:\Temp\Samples\ImportFrom"
$pwFolder = "Test-Project\Samples"
Import-PWDocuments -InputFolder $inputFolder -ProjectWiseFolder $pwFolder -ExcludeSourceDirectoryFromTargetPath
However it fails with the error ("warning"):
WARNING: Valid default storage area OR ProjectWise folder path must be provided
I have no idea what I am doing wrong and find this message rather confusing.
Hopefully someone here can help. 
Parents Reply
  • I am sorry but I cannot find the exact context and code for it. The code I used this for is now defunct.
    Did you try what 

    At some point I wrote the following function as I was experiencing some trouble with Create/Update docs in PW.
    Maybe it helps:

    #Requires -Modules pwps_dab
    function CreateOrUpdate-PWDoc {
      param (
          Mandatory = $true,
          ValueFromPipeline = $true)]
        [Parameter(Mandatory = $true)]
      Process {
        $targetDocName = Split-Path -Path $InputFilePath -Leaf
        Write-Host "Searching for document $TargetFolderPath\$targetDocName."
        $docSearch = @{
          FolderPath     = $TargetFolderPath
          JustThisFolder = $true
          FileName       = $targetDocName
          GetVersionsToo = $false
          Verbose        = $false
          WarningAction  = "Continue"  # Remove quotes around "Continue" and you'll jump to next iteration /!\
        $docs = Get-PWDocumentsBySearchWithReturnColumns @docSearch
        $matchCount = $docs.Count
        if (0 -eq $matchCount) {
          # Create new
          New-PWDocument -FilePath $InputFilePath -FolderPath $TargetFolderPath -WarningAction Stop
          Write-Host "Created new document $TargetFolderPath\$targetDocName."
        if (1 -eq $matchCount) {
          # Update/overwrite existing
          $docs[0] | Update-PWDocumentFile -NewFilePathName $InputFilePath -WarningAction Stop
          Write-Host "Updated document $TargetFolderPath\$targetDocName."
        Write-Error "The search for $targetDocName yielded $matchCount matches..."

No Data