Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Update document Description using CSV file
    • Sign In

    • State Verified Answer
    • Replies 2 replies
    • Subscribers 65 subscribers
    • Views 730 views
    • Users 0 members are here
    • Update-PWDocumentProperties

    Update document Description using CSV file

    Qadeer Hussain
    Offline Qadeer Hussain over 4 years ago

    I need to update value in Document Description attribute of multiple documents. Each document description value is different so I want  to use a PowerShell Script using Update-PWDocumentProperties. Can someone help me to create PowerShell script to update document Description of multiple documents when description value is different for each document.

    I have tried to use following script but it is not updating the Document description even I am not getting any error.

    $Objects = import-csv “C:\UpdateAttributes.csv” –header doc1,Description -delimiter '|'

    ForEach ($Object in $Objects){

    $doc1 = $($Object.doc1)

    $Description = $($Object.Description)

    $doc = Get-PWDocumentsBySearch -FolderPath "Projects\Project\800 Training\TEST" -DocumentName $doc1

    Update-PWDocumentProperties -InputDocument $doc

    Get-PWDocumentsBySearch -FolderPath "Projects\HE565628_Oxford_to_Cambridge_Expressway\800 Training\TEST" | Foreach -MemberName $Description

    }

    • Sign in to reply
    • Cancel
    Parents
    • Brian Flaherty
      0 Offline Brian Flaherty Fri, Apr 5 2019 7:20 AM

      Hi Qadeer,

      Give the following a try. Should do what  you need.

      $Objects = Import-Csv 'C:\UpdateAttributes.csv' -Header doc1,Description -Delimiter '|'
      
      ForEach ($Object in $Objects){
      
          # Get the document object to update.
          $doc = Get-PWDocumentsBySearch -FolderPath "Projects\Project\800 Training\TEST" -DocumentName $Object.doc1 -JustThisFolder
          
          # Set the value for the description.
          $doc.Description = $($Object.Description)
          
          # Update the document.
          Update-PWDocumentProperties -InputDocument $doc
      }

      Answer Verified By: Qadeer Hussain 

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Reject Answer
      • Cancel
    • Qadeer Hussain
      0 Offline Qadeer Hussain Fri, Apr 5 2019 7:46 AM in reply to Brian Flaherty

      Many thanks - it is working like a sweat Pie.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Qadeer Hussain
      0 Offline Qadeer Hussain Fri, Apr 5 2019 7:46 AM in reply to Brian Flaherty

      Many thanks - it is working like a sweat Pie.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    No Data

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies