Creating multiple saved searches

Hi guys,

I am trying to create a bunch of saved searches across multiple projects, the script below will create the saved search but only in the datasource level search folders and not within the project, can anyone help Slight smile

New-PWLogin

$searches = Import-Csv -Path "C:\Temp\savedsearch2.csv"

$getFoldersParms =@{FolderPath = "Projects\700000 - CMDP Test Project"}

Get-PWFolders $getFoldersParms -JustOne

foreach($Search in $Searches) {

Add-PWSavedSearch -searchfolder "Projects\700000 - CMDP Test Project\" -SearchName $search.Searchname -Attributes @{FI_ORIGIN_CODE = $search.Attributes; PWDM_STATUS = $search.Attributes2} -Environment $search.Environment -SearchSubFolders -ViewName "Document View" -ReplaceExisting -Verbose

}

Undo-PWLogin

Here is a snippet of my csv

...

Parents
  • The value of -searchfolder parameter specifies the folder that the saved search will search, not the folder where the search is saved.  The value of the -SearchName parameter specifies the name of the search but it can be prefixed by a ProjectWise path.   Presently all the search you create will be a the datasource level, and when they are executed the will search Projects\700000 - CMDP Test Project\,.   Since you specified  -SearchSubFolders, the sub folders will be searched also.  

    The SearchName parameter specifies the name of the search.  It can be prefixed with a folder path where the searches are stored.  If you use -SearchName 'Projects\700000 - CMDP Test Project\BEX - Quantem Engineering Developments Ltd (Accepted)' the cmdlet will create a search called 700000 - CMDP Test Project\BEX - Quantem Engineering Developments LTd (Accepted) in the folder Projects\700000 - CMDP Test Project\.   You then should specify what folder BEX - Quantem Engineering Developments Ltd (Accepted) should start the search in with the -SearchFolder parameter.  if you don't BEX - Quantem Engineering Developments Ltd (Accepted) will search the entire datasource.

    Hope this helps.  Perhaps the examples in the help will also.

     

    Mark Weisman | Bentley Systems

  • thanks for your reply, I have tried adding the full path to the search name in my excel hopefully that is what is meant by the above and still no luck, I will take another look at the examples

Reply Children
No Data