Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Look for example of powershell script
    • Sign In

    • State Suggested Answer
    • Replies 1 reply
    • Answers 1 answer
    • Subscribers 66 subscribers
    • Views 2341 views
    • Users 0 members are here
    • API
    • powershell

    Look for example of powershell script

    Luc Poulin
    Offline Luc Poulin over 5 years ago

    Need example I can send to my IT development group so they know how which API command are available for porweshell

    For example

    The Login syntax etc....

    create a script to copy document properties from one document to another OR between two Attribute sheet

    So any example that can help a developer be knowledgeable about the Powershell api

    • Sign in to reply
    • Cancel
    • Dan Williams
      0 Offline Dan Williams Mon, Aug 20 2018 5:19 PM

      Get-Command would get them a list of commands.

      Get-Help would get them help on specific commands.

      FWIW, if your IT development group uses the x86 version of the PowerShell ISE and installs and imports the latest PowerShell modules, then they can use the "Commands" window along with Get-Help to determine what commands are available, documentation including examples.

      Here's a code snippet that deals with documents and their attributes:

              $folders = Get-PWFolders -FolderID $folderId -JustOne
              foreach ($folder in $folders)
              {
                Get-PWFolderPathAndProperties -InputFolder $folder > $Null
                $documents = Get-PWDocumentsBySearch -FolderPath $folder.FullPath -JustThisFolder -GetAttributes
                foreach ($document in $documents)
                {
                  $listViewItem = New-Object System.Windows.Forms.ListViewItem
                  $listViewItem.Name = $document.Name
                  $listViewItem.Text = $document.Name
                  $listViewItem.SubItems.Add($document.Description)
                  $listViewItem.SubItems.Add($document.FileName)
                  $listViewItem.SubItems.Add($document.VersionSequence)
      
                  $title1 = ""
                  foreach ($attributePage in $document.Attributes)
                  {
                    if ($attributePage.ContainsKey("Title1"))
                    {
                      $title1 = $attributePage.Item("Title1")
                    }
                  }
                  $listViewItem.SubItems.Add($title1)
                  # $listViewItem.SubItems.Add($document.Attributes.Item(0).Item("Title1"))
                  $listViewItem.Tag = $document
                  $listView.Items.Add($listViewItem)
                }
      

      I would suggest that they take a look as some of the postings in this forum.

      HTHs

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel

    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