It seems to work so far, added a loop to get latest version of multiple given folders.
How can I have it delete the local cache? I know that I have to work with IEdmClearLocalCache but is still difficult for me to understand.
I added this to the code (to test clearing the cache):
Dim ClearLocalCache As IEdmClearLocalCache3
ClearLocalCache = vault.CreateUtility(EdmUtility.EdmUtil_ClearLocalCache) ClearLocalCache.IgnoreToolboxFiles = True ClearLocalCache.UseAutoClearCacheOption = True ClearLocalCache.CommitClear (Location(u))
I get a Run-Time error 91 on the 2nd code row.
I got a 'compile error, expected: =' on the last row when I left it empty ( ClearLocalCache.CommitClear () ) Therefor I added the location of the folder I want to clear the cache of.
Got it to work:
Dim ClearLocalCache As IEdmClearLocalCache3 Dim FolderCC Dim vault As EdmVault5 Set vault = New EdmVault5 vault.LoginAuto "Foodmate", 0 Set FolderCC = vault.GetFolderFromPath(FolderPath) Set ClearLocalCache = vault.CreateUtility(19) ClearLocalCache.IgnoreToolboxFiles = True ClearLocalCache.UseAutoClearCacheOption = True Call ClearLocalCache.AddFolder(FolderCC.ID, True) Call ClearLocalCache.CommitClear(Nothing)
This clears the local cache of a certain location (FolderPath string in my case)
I find this interesting so I made some search.
It seems that you could wait for a function by WaitForSingleObject on a process ruining (like notepad, PDM search or PDM get i guess).
I have manage to wait a process like this :
Declare PtrSafe Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Declare PtrSafe Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Public Const INFINITE = &HFFFF Function WaitForEnd(ByVal code As String) As Long Dim ProcessHandle, processID As Long ProcessHandle = OpenProcess(&H1F0000, 0, 14520) WaitForEnd = WaitForSingleObject(ProcessHandle, INFINITE) End Function Sub testototototititi() Dim code As String WaitForEnd (code) MsgBox "END !!!" End Sub "
I cannot find a way to find the Process Id from running process.
ProcessHandle = OpenProcess(&H1F0000, 0, 14520)
the "14520" Correspond the the process ID (you can find it in the task manager) . But we need to find a way to telle the process name not ID
I found that the macro only continues after it has processed the folder first (I added some simple code after it and that only showed up when the folder was completely local.