#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

HowTo: Add Document Descriptions to a Reference Report

Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.

In this post, I am going to step through the process of adding addition columns to a reference file report generated using the Get-PWReferenceReportForDocuments. By default, this report does not include the document / file descriptions. I recently had a request to add this information to the report. This is one approach which does not require any changes made to the PWPS_DAB module. And the concept can be used to manipulate other datatables when generating reports.

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

  • Get-PWDocumentsBySearch
  • Get-PWReferenceReportForDocuments
  • New-XLSXWorkbook
  • Import-PWDocuments
  • Get-Item

Parameters

First thing we need to do is create our parameter and value pairs. The comments will explain the purpose for each parameter. I am also going to include a few requires statements to ensure the correct version of PowerShell and the PWPS_DAB module are used. As well as require that the Run As Administrator option is used to run the PowerShell Console or PowerShell ISE. 

#Requires -Version 5.0
#Requires -Modules @{ModuleName="PWPS_DAB";ModuleVersion='1.12.2.0'}
#Requires -RunAsAdministrator

[CmdletBinding()]
param(
# ProjectWise Rich Project / Work Area / Folder to generate a reference report for.
[string] $pwFolderPath = 'BSI900 - Adelaide Tower',
# ProjectWise folder to import document into.
[string] $pwFolder_Import = 'PowerShell\Reports',
# Local folder to create report in.
[string] $Path = 'd:\TEMP\Export',
# Report path and name.
[string] $OutputFilePath = "$Path\$($pwFolderPath)_ReferenceReport_$(Get-Date -Format yyyyMMdd).xlsx",
# Name for datatable. Will correspond to worksheet created in Excel.
[string] $DataTableName = 'ReferenceReport'
)

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 )

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.