#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

HowTo: Use New ProjectWise Folder Object Methods

In this post, we will be looking at the three new methods added to the ProjectWise Folder object with the latest release of the PWPS_DAB module (1.24.0.0).  These methods offer a quick way to navigate to the folder within ProjectWise Explorer and to retrieve the documents contained within the folder or the folder and all subfolders.

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

  • Get-PWFolders
  • Get-PWDocumentsByGUIDs
  • Get-Member

Get Folder Object

First thing we need to do is get our ProjectWise Folder object to work with. Here I will be selecting the folder by FolderID and grabbing only ONE folder.

$pwFolder = Get-PWFolders -FolderID 177 -JustOne

pwfolder

Get Member

We can use the Get-Member cmdlet to look at the available methods for a ProjectWise Folder object. Here we will pipe the folder object to the Get-Member cmdlet. We are only concerned with the methods, so we use the Where-Object to filter the returned data.

$pwFolder | Get-Member | Where-Object MemberType -eq Method

The following shows the available methods. Notice we have three new ones.

  • GetFolderDocuments
  • GetTreeDocuments
  • Locate

getmember

GetFolderDocuments / GetTreeDocuments

One caveat with using these methods is that NOT all of the metadata associated with the documents is returned. However, you could use something like the following to resolve that.

$pwDocumentsByGUID = Get-PWDocumentsByGUIDs -DocumentGUIDs ($pwDocuments.DocumentGUID).Guid

The first method, .GetFolderDocuments() offers a quick way to retrieve all of the documents within the folder identified within the ProjectWise Folder object Only.

$pwDocuments = $pwFolder.GetFolderDocuments()

The second method, .GetTreeDocuments() offers a quick way to retrieve all of the documents with the folder identified within the ProjectWise Folder object, and all documents within any subfolders.

$pwDocuments_EntireProject = $pwFolder.GetTreeDocuments()

The following shows the results.

doccounts

Locate Method

Now that we have our folder object, we can use the new .Locate() method to navigate to the corresponding folder within ProjectWise Explorer.

$pwFolder.Locate()

pwe


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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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