Hello,
I am doing a Vault Customization using C# as development language in Visual Studio 2010.
Refer the below code
using (FileStream stream = newFileStream(filePath, FileMode.Open, FileAccess.Read))
{
ByteArray fileData = newByteArray();
fileData.Bytes = newbyte[stream.Length];
stream.Read(fileData.Bytes, 0, fileData.Bytes.Length);
serviceManager.DocumentService.AddFile(folderId, Path.GetFileName(filePath), "Test", System.IO.File.GetLastWriteTime(filePath), null, null, FileClassification.DesignVisualization, false, fileData);
}
Using this above code which is present in SDK i am inserting files to Vault.
Again for some operation if i want to do certain operation on this file using its file id i get error as
1013 GetFileFailed Cannot get file (file id is invalid).
When i have inserted this file using this above mentioned method i get the error
Autodesk.Connectivity.WebServices.File test = mgr.DocumentService.GetFileById(fle.Id);
Here fle.ID is the ID of that inserted file which i get using iteration.
Please help.
Cheers,
Amit
Hi,
I am using Vault 2013 Professional.
Here i an adding a new DWF file using the above mentioned code.
Then i attach the dwf file to DWG/IDW.
long AttachmentFileID = 0;
foreach (Autodesk.Connectivity.WebServices.File fle in Files)
{
//if(fle.Name.Equals(kCheckOutPath.Replace(".idw",".dwf")))
if (fle.Name.Equals(System.IO.Path.GetFileName(kCheckOutPath.Replace(".idw", ".dwf"))))
{
AttachmentFileID = fle.Id;
Autodesk.Connectivity.WebServices.File pFile = mgr.DocumentService.GetLatestFileByMasterId(Main_File_Master_ID);
//Autodesk.Connectivity.WebServices.File pFile = mgr.DocumentService.GetLatestFileByMasterId(file.MasterId);
FileAssocParam fileParam1 = new FileAssocParam();
fileParam1.CldFileId = fle.MasterId; ;
fileParam1.ExpectedVaultPath = folders[0].FullName + "/" + System.IO.Path.GetFileName(kCheckOutPath.Replace(".idw", ".dwf"));
fileParam1.Source = "";
fileParam1.RefId = "";
fileParam1.Typ = AssociationType.Attachment;
mgr.DocumentService.AddDesignVisualizationFileAttachment(pFile.Id, fileParam1);
//mgr.DocumentService.AddDesignVisualizationFileAttachment(file.Id, fileParam1);
System.IO.File.Delete(kCheckOutPath.Replace(".idw", ".dwf"));
}
}
Here i am attaching the dwf to available IDW/DWG.
But i am getting problem on AddDesignVisualizationFileAttachment line.
Then i checked this below line
Autodesk.Connectivity.WebServices.File test = mgr.DocumentService.GetFileById(fle.Id);
I found out that the added file id is improper.
This is where problem lies, i am trying to attach a dwf file to existing idw/dwg but its not allowing me to attach. Before attaching i will remove the previous attachment present if any and attach new one.
Can you suggest me where am i going wrong.
rgds
Amit
Can't find what you're looking for? Ask the community or share your knowledge.