GetLocalFileStatus - Vault 12 API

GetLocalFileStatus - Vault 12 API

cadmageren
Enthusiast Enthusiast
2,313 Views
14 Replies
Message 1 of 15

GetLocalFileStatus - Vault 12 API

cadmageren
Enthusiast
Enthusiast

Hi

 

I am developing a small program, based on VaultBrowser SDK Sample.

 

I am trying to get the Local filestatus of a file: C:\Vault\Designs\W\B2-4510070.idw

In Vault Explorer I can see that the file is downloaded (white circle), and when I rightclick Go to working folder, I correctly go to the specified file.

 

But when testing through API GetLocalFileStatus returns: InVaultButNotOnDisk

 

So after some investigation I find that GetRequiredWorkingFolderLocation(...)  = "C:\users\mic\documents\Vault"

This folderpath does not exists! This tells me that the API call is looking in the wrong location - thus giving the wrong message.

 

Bonus info:

GetRequiredWorkingFolderLocation() = "C:\Vault\"

GetEnforceWorkingFolder = True

 

 

Any suggestions on how else I should compare local file and vault file?

 

Any comments appreciated.

 

Michael Christoffersen

 

0 Likes
Accepted solutions (1)
2,314 Views
14 Replies
Replies (14)
Message 2 of 15

Redmond.D
Autodesk
Autodesk

This is a known issue.

Unfortunately IExplorerUtil.GetWorkingFolder(...) only works if you are using the default working folder. GetLocalFileStatus(...) and DownloadFile(File, Folder) are also broken as a result.

 

Until we put out a fix, there is no workaround.   And I don't have an ETA on when a fix will be available.

 

Sorry.



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 3 of 15

cadmageren
Enthusiast
Enthusiast

Hi Doug, and thanks for the swift reply.

 

There must be a solution on how to compare a local file with the one in Vault?

 

I am trying to compare the file system modification date on the local folder with the Vault file, but that date is apparantly not reliable either.

 

Where is the "default working folder" specified?

If the Enforce Workfolder is enabled, then how can this work with the users own document folder?

 

/Michael

 

 

0 Likes
Message 4 of 15

Redmond.D
Autodesk
Autodesk
Accepted solution

GetEnforceWorkingFolder() tells you if there is an enforced working folder in effect.

GetRequiredWorkingFolderLocation() tells you the location of the enforced working folder.

Both functions are in the DocumentService.

 

If there is no enforced working folder set, you need to read in the local settings to find the mapping between vault folder and local folder.  The local settings are stored as XML files.  This blog post tells you where you can find the settings files.



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 5 of 15

psaarloos
Collaborator
Collaborator

Hi Doug,

 

Should the GetLocalFileStatus method have been fixed in Vault 2013? I am playing around with it a bit, but it seems it always returns 'MatchesNoVaultVersion' or if the file doesn't exists locally 'InVaultButNotOnDisk'.

 

My test Vault has the EnforceWorkingFolder and the Enforce Unique File Names options checked.

 

Any idea why the GetLocalFileStatus is never returning 'MatchesLatestVaultVersion' or 'MatchesOlderVaultVersion'?

 

I downloaded the latest file from Vault by using the IExplorerUtil.DownloadFile and after that I am calling the GetLocalFileStatus function. I would expect a returned VersionState: ''MatchesLatestVaultVersion'.

 

Regards,

Pim Saarloos

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 6 of 15

Redmond.D
Autodesk
Autodesk

I think you need to set the file attributes after the download, even if you use IExplorerUtil.DownloadFile.

http://justonesandzeros.typepad.com/blog/2010/02/setting-file-attributes-on-download.html

 

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 7 of 15

psaarloos
Collaborator
Collaborator

Tried that, but still without the expected result...

 

I tested the three methods below. There must be another property not completly set correctly by the DownloadFile method. I also don't see any difference with or without setting the file info. It looks like the IExplorerUtil.DownloadFile method already takes care of the creation data and read-only flag..

 

Get Latest of file by using Vault Explorer

GetLocalFileStatus --> MatchesLatestVaultVersion

 

Get Latest of file by using IExplorerUtil.Download file (without programmatically setting CreationDate and Attributes)

GetLocalFileStatus --> MatchesNoVaultVersion

 

Get Latest of file by using IExplorerUtil.Download file (with programmatically setting CreationDate and Attributes)

GetLocalFileStatus --> MatchesNoVaultVersion

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 8 of 15

psaarloos
Collaborator
Collaborator

I also compared the FileInfo properties of the file downloaded through Vault Explorer and by using the IExplorerUtil.DownloadFile method. The results are listed below. The only difference I can find is the length property of the file. However, I am not sure if that's causing the problem and how I could solve it.

 

Vault Explorer:

CreationTime: 8-2-2013 14:45:01

LastAccessTime: 12-2-2013 15:09:38

LastWriteTime : 12-2-2013 15:09:38

Attributes: ReadOnly, Archive

Length: 222720

 

IExplorerUtil.DownloadFile:

CreationTime: 8-2-2013 14:45:01

LastAccessTime: 12-2-2013 15:09:38

LastWriteTime : 12-2-2013 15:09:38

Attributes: ReadOnly, Archive

Length: 224256

 

Regards,

Pim Saarloos

 

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 9 of 15

psaarloos
Collaborator
Collaborator

I performed some other checks...

 

If I get the latest version of a file through Vault Explorer, the grid in Vault shows a white circle synbol. Indicating the local file matches the latest version in Vault.

 

If I use the IExplorerUtil.Download method to download the latest version of a file, Vault Explorer is also showing a white circle symbol.

 

Is Vault Explorer using a different mechanism to check the state of the local file? Is there anything I could do to make the GetLocalFileState function to work..? Or could there still be a bug in this function?

 

Regards,

Pim

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 10 of 15

Redmond.D
Autodesk
Autodesk

Is this file an assembly file that might have updated references?  The file resolution feature means that sometimes the file gets edited during download.  It may be that GetLocalFileStatus is not taking this change into account.

 

What happens when you try to get the status on a simple text file?



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 11 of 15

psaarloos
Collaborator
Collaborator
Hi Doug,

You're right. The Resolver is causing the 'wrong' VersionState. I had a simple drawing with a reference to the part on it. I checked out the drawing, saved it and checked it back in. Now the VersionState is showing the correct state.

Can this be logged as a defect or do you recommend using the DownloadFile method of the DocumentService?

Regards,
Pim
Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 12 of 15

Redmond.D
Autodesk
Autodesk

This issue should be fixed for the upcoming Vault release, so I will not be logging a defect.

You can use the DocumentService to download if you want, but it won't fix up any broken file references.

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 13 of 15

psaarloos
Collaborator
Collaborator
Hi Doug,

The GetLocalFileStatus method doesn't exist anymore in the IExplorerUtil in Vault 2014. What method should be used in the new version of Vault? Could you show how to use it with a small code sample?

Regards,
Pim

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Message 14 of 15

Redmond.D
Autodesk
Autodesk

The changes page in the API documentation states that Connection.PropertyManager.GetPropertyValue is the replacement for GetLocalFileStatus.  I don't think I have any sample code at the moment, but I'll go over the basic steps.

 

The VDF can read properites that live server side (ex. file name, check out date) and properties that are calculated client side (ex. file status). 

 

Steps:

  1. Get the VaultStatus system name from Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyDefinitionIds.Client.VaultStatus
  2. Get the PropertyDefinition object by calling Connection.PropertyManager.GetPropertyDefinitionBySystemName
  3. Get the status by calling Connection.PropertyManager.GetPropertyValue.
  4. Cast the return object to type Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.EntityStatusImageInfo
  5. Now you have both the status information and the status icon.

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 15 of 15

psaarloos
Collaborator
Collaborator

Hi Doug,

 

Thanks for pointing this out! I was able to retrieve the VaultStatus property through the new PropertyManager. Works much quicker as well now! Great!

 

Regards,

Pim

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes