#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Build ProjectWise Links

In this post I am going to show how to build document URNs and Projectwise Web links.

All of the ProjectWise related cmdlets are available using the PWPS_DAB module. At the time of this post, I am using version 23.2.6.0. Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.

  • Get-PWCurrentDatasource
  • Show-PWFolderBrowserDialog
  • Get-PWDocumentsBySearch

 

The first thing we need to do is get our datasource name. Then create a copy of it and replace the colon with ‘~3A’. This is used for the ProjectWise Web Link.

$dataSource = Get-PWCurrentDatasource
$datasSourceUpdated = $dataSource.Replace(':', '~3A')

Next we will select the containing ProjectWise folder and then the documents.

$FolderPath = (Show-PWFolderBrowserDialog).FullPath
$pwDocs = Get-PWDocumentsBySearch -FolderPath $FolderPath

Once we have the document objects, we can loop through them, build the URNs and WebLinks and then apply them to the documents.


foreach($pwDoc in $pwDocs){ # break
    $pwLink = "https://connect-projectwisewac.bentley.com/pwlink/?objectId=$($pwDoc.DocumentGUID)&objectType=doc&datasource=Bentley.PW--$($datasSourceUpdated)&app=pwe"
    $pwURN = "pw://$($dataSource)/Documents/D{$($pwDoc.DocumentGUID)}"

# Apply the new URN and WebLink to the current ProjectWise document. $pwDoc.DocumentURN = $pwURN $pwDoc.ProjectWiseWebLink = $pwLink }

 

Experiment with it and have fun. Hopefully, you find this useful.

Please let me know if you have any questions or comments. 

If you like this post, please click the Like button at the bottom of the page.

2 thoughts on “How To: Build ProjectWise Links”

    1. Hey Jonathan,
      First, thanks for visiting my blog. Hopefully, you find it useful.
      I am not sure what you are referring to here, can you please explain what you my “missing the update document command…”.
      Cheers,
      Brian

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.