Query/Reset File status using C#

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
tschneider
Posts: 50
Joined: Mon Aug 25, 2014 2:00 am

Query/Reset File status using C#

Post by tschneider » Tue Mar 08, 2016 1:59 am

Hello,

how can i query the file status of an open project using VAULT API.
I want to get all files of Status=Renegade and reset it using API?

best
Thomas

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Query/Reset File status using C#

Post by Beth » Tue Mar 08, 2016 8:46 am

Are the files Renegade because there are changes? Or are they renegade because they were touched by a program? If there are changes, do you need to keep those changes?
Beth Kieler
SourceGear Technical Support

tschneider
Posts: 50
Joined: Mon Aug 25, 2014 2:00 am

Re: Query/Reset File status using C#

Post by tschneider » Tue Mar 08, 2016 9:04 am

There are changes and i want to reset them by API.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: Query/Reset File status using C#

Post by Beth » Tue Mar 08, 2016 12:04 pm

To get rid of renegade changes, you would have to perform a Get with overwrite. If you need to keep the changes, then your options are to check out the file and check it in, or to keep a renegade status, or to switch to using CVS mode which keeps all the files writable.

For example, to do the Get with overwrite:
  • a) Call
    ClientInstance.GetWorkingFolder(VaultClientFolder) OR ClientInstance.GetWorkingFolder(String strPhysicalDiskPath, true)

    to get a working folder instance.

    b) With the Working Folder object returned from step A, call

    WorkingFolder.GetStatus() or WorkingFolder.GetStatusForAllFiles()

    This would return the status of a known VaultClientFile or the files found in a known VaultClientFolder.

    c) Call GET() with the file's same version/object version id, the 'forceLatest' set to false, and overwrite set to true.
Beth Kieler
SourceGear Technical Support

Post Reply