Doug - thanks for your assistance - have gotten past the issue of getting the documents. Now that I have the documents I am doing a check out - update - check in. When I do this with a dwg I also check out the DWF and update it also then check it back in. Problem I have is when checking in the DWG I lose the DWF that is attached to it. I see in the check in command attachfileids() as long - what ID do you put here???
I also used the GetDesignVisualizationAttachmentsByFileMasterIds - thought it would have some ids in it but can't seem to get it to work
'get dwf files from attachments array
Dim ps_file_assc() As Document.FileAssocArray
ps_file_assc = document.GetDesignVisualizationAttachmentsByFileMasterIds(file_mast_ids)
'checkout Parent document
document.CheckoutFile(folders(y).Folders(0).Id, ps_file.MasterId, Environment.MachineName, _
"c:\\temp", "Revision Update", True, True, bytes)
If Right(ps_file.Name, 3) = "DWG" Then
'check out DWF
document.CheckoutFile(folders(y).Folders(0).Id, ps_file_assc(y).FileAssocs(0).CldFile.MasterId, _
Environment.MachineName, "c:\\temp", "Revision Update", True, True, bytes)
'update DWF
Dim filePath As String = "c:\_import\dwf\" & dr_sub_rev(6) & "." & dr_sub_rev(7) & ".DWF"
bytes = System.IO.File.ReadAllBytes(filePath)
document.CheckinFile(ps_file_assc(y).FileAssocs(0).CldFile.MasterId, "Bulk Loading", False, _
System.IO.File.GetLastWriteTime(filePath), Nothing, Nothing, Nothing, Nothing, Nothing, False, _
ps_file_assc(y).FileAssocs(0).CldFile.Name, ps_file_assc(y).FileAssocs(0).CldFile.FileClass, _
ps_file_assc(y).FileAssocs(0).CldFile.Hidden, bytes)
Dim attatch_id() As Long
ReDim attatch_id(0)
attatch_id(0) = ps_file_assc(y).FileAssocs(0).Id
filePath = dr_sub_rev(18) & "\" & dr_sub_rev(6) & "." & dr_sub_rev(7)
bytes = System.IO.File.ReadAllBytes(filePath)
document.CheckinFile(ps_file.MasterId, "Bulk Loading", False, System.IO.File.GetLastWriteTime _
("c:\\temp"), Nothing, Nothing, ??????????, Nothing, Nothing, False, ps_file.Name, ps_file.FileClass, _
ps_file.Hidden, bytes)
Else
filepath = dr_sub_rev(18) & "\" & dr_sub_rev(6) & "." & dr_sub_rev(7)
bytes = System.IO.File.ReadAllBytes(filepath)
document.CheckinFile(ps_file.MasterId, "Bulk Loading", False, System.IO.File.GetLastWriteTime _
("c:\\temp"), Nothing, Nothing, Nothing, Nothing, Nothing, False, ps_file.Name, ps_file.FileClass, _
ps_file.Hidden, bytes)
End If
Thanks
Craig
Edited by: Craig_Schuler on Jul 21, 2009 6:37 AM