HI im trying to get the content of an Autodesk Navisworks (NWD) file.
here is a simple version of what im trying todo -
$fileCont = Get-Content -Path $filePath
New-Item C:\Temp\tom2.nwd
Set-Content C:\Temp\tom2.nwd $fileCont
For this to prove that I can successfully collect the content of the navisworks file..
although this is a simple workflow and what i'm trying to achieve is greater thank this, if i can figure this bit out i know the rest..
here is the error when i try to open C:\Temp\tom2.nwd
you're correct this method did work but was extremely slow and un usable, but i can now confirm that by following this post
i used the following method to collect and post the data in the file.
write-host "Creting object in bucket.."
$B_Key = ''
write-host "Bucket Key ="$B_Key
write-host "File Content being uploaded to bucket object"
$currentDir = Get-Location
$sourceFile = [System.IO.Path]::Combine($currentDir, 'rac_basic_sample_project_pstest.rvt')
$fileName = [System.IO.Path]::GetFileName($SourceFile)
Set-ItemProperty -Path $sourceFile -Name IsReadOnly -Value $false
$Clen = Get-Item $sourceFile
$Clen = $Clen.Length
write-host $Clen
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $token")
$headers.Add("Content-Type", "application/octet-stream")
$headers.Add("Content-Length", $CLen)
$CreateObj = 'https://developer.api.autodesk.com/oss/v2/buckets/'+$B_Key+'/objects/'+$fileName
$CreateObjAPIresult = Invoke-RestMethod -Uri $CreateObj -Method Put -Headers $headers -InFile $sourceFile
write-host "New Object Created in bucket"