Occasionally, while working within PowerShell you will need to access a folder or document within the ProjectWise Explorer client. This can easily be done using the folder or document URN. In this post, I will demonstrate how to navigate to a ProjectWise (PW) folder or document within ProjectWise Explorer (PWE) from PowerShell using a URN.
All of the ProjectWise related cmdlets are available using the PWPS_DAB module. At the time of this post, I am using version 2.1.2.0. Take a look at the help for each of the cmdlets to become familiar with their functionality, available parameters, etc.
- Show-PWFolderBrowserDialog
- Show-PWDocumentSelectionDialog
- Start-Process
Get Folder / Document Objects
The following offers one method of obtaining a folder or document object. I will be using the browser dialogs to interactively select a folder and document.
# Select ProjectWise folder object
$pwFolder = Show-PWFolderBrowserDialog
# Select ProjectWise document object
$pwDocument = Show-PWDocumentSelectionDialog
The following shows the selection of a PW folder.
The following shows the selection of the PW document.
The following two images show the folder and document object URN values.
Navigate to Objects
Now that we have our PW folder and document objects, we can navigate to them within PWE from our PowerShell session using the Start-Process cmdlet.
# Navigate to the PW folder within PWE.
Start-Process -FilePath $pwFolder.ProjectURN
# Navigate to the PW document within PWE.
Start-Process -FilePath $pwDocument.DocumentURN
The following shows the folder navigated to within PWE.
The following shows the document navigated to within PWE.
Summary
Although this is a very simple process, it can be quite useful.
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.
Brian, you should point out that they can use the .Locate() method on both Document and Folder objects to achieve the same thing. I believe that also will populate the URN if it is blank for some reason. Have also recently added a couple of flavors of web links as default properties on those objects. Dave.
LikeLike
I did not realize the .Locate() was available. I will have to give it a try. Thanks Dave.
LikeLike