Hope you get this working. Sounds really neat!
Yeah, instead of using the OpenFileDialog that can't see the uncached files, use the BrowseForFile Method (IEdmVault5), it won't let you down. The code below makes the assumption you have already gotten the vault object and you have somehow already logged in the user which are shown below as <yourvaultobject>. I've also included a line <insert your code here to add the current file to the reference list> which is the "file" object just retrieved.
'Let the user select multiple files Dim PathList As IEdmStrLst5 PathList = <yourvaultobject>.BrowseForFile(0, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitMultipleSel + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select File...") 'If the user didn't press Cancel... If Not PathList Is Nothing Then 'Spin through all the files and do something Dim pos As IEdmPos5 = Nothing Dim file As IEdmFile5 = Nothing pos = PathList.GetHeadPosition While Not pos.IsNull file = <yourvaultobject>.GetFileFromPath(PathList.GetNext(pos), 0) <insert your code here to add the current file to the reference list> End While End If
You will need to figure out how to get the vault object on your own, using your codebase you already have.
Hope this helps,
Thanks again for the suggestion. I implemented BrowseForFile from within my excel VSTO code, however it remains the case that even for this methodology the auto caching of "single-clicked" files in the file browser dialog does not trigger as desired.
From within my excel vsto vb.net code I do instantiate an iedmvault5 object, log in OK and can browse and select files, but the "auto cache upon single click" behavior is not taking place. When I write the same code it its own executable, it auto caches as desired.
my workaround is to create a separate openfiledialog.exe that is called by the vsto code via the process keyword - in this case, the code running the openfiledialog object is NOT directly tied to the excel vsto code and therefore does perform the auto caching...
Could you use GetFileCopy to force a "Get" operation? You can then "Get" the file to any folder, not just within PDM.
'Get the interface to the file and its parent folder Dim file As IEdmFile5 Dim folder As IEdmFolder5 = Nothing file = vault.GetFileFromPath(filePath, folder) If file Is Nothing Then MessageBox.Show("The file is not in the vault " + VaultName + ".") Else 'Check out the file file.LockFile(folder.ID, Me.Handle.ToInt32()) MessageBox.Show("Checked out " & file.Name & " in vault " + VaultName + ".") 'Copy the file Dim verEnum As IEdmEnumeratorVersion5 verEnum = file Dim Version As Integer Version = file.GetLocalVersionNo(folder.ID) Dim ver As IEdmVersion5 ver = verEnum.GetVersion(Version) ver.GetFileCopy(Me.Handle.ToInt32(), "c:\temp\") MessageBox.Show("Copied " & file.Name & " to c:\temp.") End If
I had the same issue a few years back, but my issue was the opposite. The "auto-cache" feature you want, I believe is actually a bug. The only time a dialog window should actually download the file is if it's trying to generate a preview or it's told to get version/latest. The OpenFileDialog is the culprit... you may want to create your own opendialogbox function to create the desired response.
594331 / 816512 / 925218 / 927445
Turns out there are lots of caching issues when using file dialog boxes...