Hi,
I have customize the "New Standard File" command of the Vault Data Standard 2014. During the creation of the new file, I also create a new folder location for this file (within the default.ps1). After te file creation I want to navigate to the file but this doesn't seems to work.
Underneath you will find the code from my CreateFile.PS1:
# Force Refresh add command end $vaultContext.ForceRefresh = $true # Define Dialog Location $dialog = $dsCommands.GetCreateDialog($folderId) $xamlFile = New-Object CreateObject.WPF.XamlFile "CreateFile", "C:\ProgramData\Autodesk\Vault 2014\Extensions\DataStandard\Vault\Configuration\File.xaml" $dialog.XamlFile = $xamlFile # Execute File Dialog $result = $dialog.Execute() # Get Filepath and FileID $folderId = $dialog.CurrentFile.FolderId $folder = $vault.DocumentService.GetFolderById($folderId) $path = $folder.FullName + "/" + $dialog.CurrentFile.Name # Navigate to new file location [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Autodesk\Vault Professional 2014\Explorer\Autodesk.Connectivity.Explorer.Extensibility.dll") $selectionId = [Autodesk.Connectivity.Explorer.Extensibility.SelectionTypeId]::File $location = New-Object Autodesk.Connectivity.Explorer.Extensibility.LocationContext $selectionId, $path $vaultContext.GoToLocation = $location
If the file is placed in an already excisting place, the navigation will work.
I think this has something to do with the browser refresh action taking place after the GoToLocation is fired.
Anyone an idea how to resolve this problem?
Thanks in advance,
Peter
Hi Peter, just to make sure i got you right. You create a new folder within the default.ps1, while the Data Standard dialog is open, right? Where is the file then located, in the new folder or in the one you had selected at the moment of creation?
the $dsCommands.GetCreateDialog function requires the folder ID of the folder where the file should be created. Once the dialog closes, you have in $dialog.CurrentFile.FolderId the folder Id, but i'm not sure if this is still the folder ID passed to the GetCreateDialog function. if that is the case, then obviously the $vaultContext.GoToLocation goes to the original folder and not the new one.
in order to bring some light in here, you could do 2 simple tests:
If you post the results of these 2 tests, then we can look together for a solutions.
ciao
marco
Hi Marco,
Yes, I'm creating a new folder in the default.PS1 when the dialog is open. The new file is put in this new folder.
I've forced the $Path to the fixed location, but this didn't work.
When I inspect the variables, the CurrentFile.FolderId is giving me the folderID of the newly created folder.
I've also put the $dsDiag.Inspect() just before and after the $vaultContext.GoToLocation to check what happens with the variables. I was supprised that the $vaultcontext.GoToLocation and $vaultcontext.ForceRefresh were $null.
I'm still thinking this is a timing issue. Is there another way to force the interface to refresh? Or do you see another cause/solution?
Best regards,
Peter
Hi Peter, maybe i'm still missing something. You create a new folder while the NewFile dialog is open and save the file into that new folder. As the dialog closes, you like to move directly to the new folder with the new file, right?
Where do you create the new folder in the Default.ps1, in which function? And how do you set the new path in the default.ps1?
I'm trying to reproduce your scenario, but i'm missing some pieces.
ciao
marco
Hi Marco,
Today I had planned to create a sample project for you. But when I tested the behaviour once again, it suddenly worked. So everything is working fine.
Thanks for looking in to my problem.
Kind regards,
Peter
Can't find what you're looking for? Ask the community or share your knowledge.