Autodesk Vault Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
I am using Vault Professional 2013 and customzing using C#. I am stuck up with updating issue.
Problem: My current problem is to update only attachment file, not the original file.
Lets consider we have dwg file and its assiciated dwf. I download this dwf make certain changes and upload to vault.
How to update only attachment file.
Regards
Amit
Solved! Go to Solution.
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You check out the attachment, make your updates on disk, and check in the attachment.
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for reply Doug, I actually did this but the associativity between dwg and dwf is lost.
When i click in dwg it won't display this preview. Can you suggest me some methods on how to do this.
Rgds
Amit
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
What does your check-in code look like? Are you keeping the same classification and hidden values?
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This is my code for checkin
I refered from this below link and made some modification to suit my requirement
// Check in the file
public Autodesk.Connectivity.WebServices.File Checkin(Autodesk.Connectivity.WebServices.File file, FileClassification fileClassification, Boolean hidden)
{
Autodesk.Connectivity.WebServices.File retFile = null;
string filePath = Path.Combine(kCheckOutPath, file.Name);
using (FileStream stream = new FileStream(filePath, FileMode.Open,FileAccess.Read))
{
byte[] fileData = new byte[stream.Length];
stream.Read(fileData, 0, fileData.Length);
ByteArray IFileData=new ByteArray();
IFileData.Bytes=new byte[stream.Length];
stream.Read(IFileData.Bytes, 0, IFileData.Bytes.Length);
// Perform the upload
if (fileClassification == FileClassification.DesignVisualization)
{
retFile = mgr.DocumentService.CheckinFile(file.MasterId, "",false, System.IO.File.GetLastWriteTime(filePath),null , null, false,file.Name, file.FileClass, hidden, IFileData);
for (int i = 0; i < fileAssocParamList.Count; i++)
{
FileAssocParam param1 = (FileAssocParam)fileAssocParamList[i];
if (param1.CldFileId == file.Id)
{
param1.CldFileId = retFile.Id;
}
}
System.IO.FileAttributes attr = System.IO.File.GetAttributes(filePath);
//the local file can't be read only.
if ((attr & System.IO.FileAttributes.ReadOnly) == 0)
{
System.IO.File.SetAttributes(filePath, FileAttributes.ReadOnly);
}
}
else
{
// Get bom
Autodesk.Connectivity.WebServices.BOM tbom =mgr.DocumentService.GetBOMByFileId(file.Id);
FileAssocParam[] paramArray = (FileAssocParam[])fileAssocParamList.ToArray(typeo
//retFile = mgr.DocumentService.CheckinFile(file.MasterId, file.Comm,false, System.IO.File.GetLastWriteTime(filePath),paramArr
retFile = mgr.DocumentService.CheckinFile(file.MasterId, file.Comm, false, System.IO.File.GetLastWriteTime(filePath), paramArray, tbom, true, file.Name, file.FileClass, hidden, IFileData);
if (System.IO.File.Exists(filePath) == true)
{
System.IO.FileAttributes attr =
System.IO.File.GetAttributes(filePath);
//the local file can't be read only.
if ((attr & System.IO.FileAttributes.ReadOnly) == 0)
{
System.IO.File.SetAttributes(filePath, FileAttributes.ReadOnly);
}
}
}
}
return retFile;
}
Thanks and Regards
Amit
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That code looks correct to me. The next thing to try is AddDesignVisualizationFileAttachment. Use that function to create a new link from the parent DWG to your new DWF version.
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Ok Doug, thanks for information. I will work on it and get back to you.
Rgds
Amit
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
No Doug, i am not able to use AddDesignVisualizationFileAttachment. I am still under confusion on how to achieve this.
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You need to be more specific. Are you getting an error when using AddDesignVisualizationFileAttachment? Are you confused on what to pass in?
Re: Update Attachment
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yes Doug, you are absolutely right I am getting confused on what to pass.
I tried to get AddDesignVisualizationFileAttachment in place of FileDesignVisualization, but the object doesn't exists. What exactly should i pass to methods.
Rgds
Amit




