Hi,
Is there any cmdlet available to generate the ProjectWise Documents URL in bulk or in batch.
Thank you!
Regards,
Amol Sonawane
Which URL are you looking for? The one that you get when you right-click the address bar and select Copy URL or Copy URN, or the one when you right-click a file and pick Get Link..
You can get a URN link from the first method by using Get-PWDocumentsBySearch with the -slow option. It's the DocumentURN property
$pwDocs = Get-PWDocumentsBySearch -Folder 'path\to\files' -Slow
$pwDocs | Select FileName, DocumentURN
the -slow option really is slow, if you want to build your own URN without needing that
$pwServer = Get-PWCurrentDatasource $pwDocs = Get-PWDocumentsBySearch -Folder 'path\to\files' $URNs = @() ForEach ($d in $pwDocs) { $URNs += "pw://$($pwServer)/Documents/D{$($d.DocumentGUIDString)}" } $URNs
You can build a URN to a folder using the code above by using Get-PWFolders and in the URN changing the D{ to a P{ and changing DocumentGUIDString to ProjectGUIDString
I don't know of a way to programmatically get the Get Link... style of link. You can build older style URLs instead of URNs but you'll have to fetch the full path using -PopulatePath on the Get-PWDocumentsBySearch (which is slow) and you may also need to URL encode the results. The URN method is way easier.
Thank you Ken for reply. Business need to send the link to vendor to work on as they also have and access to ProjectWise, We are looking generate the bulk URLs from ProjectWise.
Are they using ProjectWise explorer or the web to access documents?
We would like to generate the Web links with file Name and Export in excel.
For the old school web server this should work:
$webserver = 'https://webserver.fqdn/default.aspx' # get projectwise integration server and datasource ($pwServer,$pwds) = (Get-PWCurrentDatasource).Split(':',2) $pwDocs = Get-PWDocumentsBySearch -Folder 'path\to\files' $URLs = @() ForEach ($d in $pwDocs) { $location = "$($pwServer)%3A$($pwds)" $link = [System.Web.HttpUtility]::UrlEncode("pw://$($pwServer)/Documents/D{$($d.DocumentGUIDString)}") $URLs += "$($webserver)?location=$($location)&link=$($link)" } return $URLs
I tried the below to create a link for going through connect.bentley.com but it didn't work for me. The projid from PowerShell doesn't match up to the projID in the web service. Not sure how to fix that.
$webserver = 'https://connect-projectwisewac.bentley.com//' # get projectwise integration server and datasource ($pwServer,$pwds) = (Get-PWCurrentDatasource).Split(':',2) $pwDocs = Get-PWDocumentsBySearch -FolderPath 'Caddlib\Connect\_Configuration\FindSubFolder' -Filename 'find%.cfg' $URLs = @() ForEach ($d in $pwDocs) { $datasource = "$($pwServer)~3A$($pwds)" $objID = $d.DocumentGUIDString $objType = 'doc' $waID = (Get-PWRichProjectForDocument -InputDocument $d).ProjectGUIDString # This doesn't work, connect.bentley.com uses a different GUID for projID! $projID = (Get-PWfolders -FolderID $d.ProjectID -JustOne).ProjectGUIDString $URLstring = "$($webserver)pwlink?datasource=Bentley.PW--$($datasource)&" $URLstring += "objectId=$($objID)&objectType=$($objType)&workAreaId=$($waID)&" $URLstring += "projectId=$($projID)&app=web" $URLs += $URLstring } return $URLs
Oh I figured out how to make links for connected projects, have to use the ConnectedProjectID for the projID part of the url. This works for me now:
$webserver = 'https://connect-projectwisewac.bentley.com//' # get projectwise integration server and datasource ($pwServer,$pwds) = (Get-PWCurrentDatasource).Split(':',2) $pwDocs = Get-PWDocumentsBySearch -FolderPath 'Caddlib\Connect\_Configuration\FindSubFolder' -Filename 'find%.cfg' $URLs = @() ForEach ($d in $pwDocs) { $rp = Get-PWRichProjectForDocument -InputDocument $d $datasource = "$($pwServer)~3A$($pwds)" $objID = $d.DocumentGUIDString $objType = 'doc' $waID = $rp.ProjectGUIDString $projID = $rp.ConnectedProjectId $URLstring = "$($webserver)pwlink?datasource=Bentley.PW--$($datasource)&" $URLstring += "objectId=$($objID)&objectType=$($objType)&workAreaId=$($waID)&" $URLstring += "projectId=$($projID)&app=web" $URLs += $URLstring } return $URLs