Deleting a file programmatically

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
daveharruk
Posts: 4
Joined: Mon Nov 03, 2008 5:00 am

Deleting a file programmatically

Post by daveharruk » Mon Nov 03, 2008 8:45 am

Hi,

I'm using Vault 4.1.0.16216, and am writing a Visual Studio 2008 package which needs to be able to remove a file from a project, including from source control. When I remove a file from a project programmatically, it ends up listed as "missing" in Vault after checking all changes back in, whereas if I remove it manually using the Visual Studio menu command, it is correctly deleted from Vault. Therefore I am wondering if there is any API or command line utility that I can use to delete the file from Vault in my code; the deleted file is correctly removed from the project in both cases; to remove the file in code I'm using the IVsProject2.RemoveItem method. If anybody has any ideas about how I might accomplish this, I'd be grateful.

Cheers,

Dave Harrington.

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Re: Deleting a file programmatically

Post by jeremy_sg » Mon Nov 03, 2008 2:38 pm

You should be able to use the Vault command-line client to delete the file:

Code: Select all

"c:\program files\sourcegear\vault Client\vault.exe" -host myvaultserver -username user -password mypassword -repository "Repository Name" c:\path\to\file.txt -commit
Subscribe to the Fortress/Vault blog

daveharruk
Posts: 4
Joined: Mon Nov 03, 2008 5:00 am

Re: Deleting a file programmatically

Post by daveharruk » Tue Nov 04, 2008 3:09 am

Jeremy,

Thanks, I will try that out - I guess it's not ideal as I'll need to store the server/username/password details somewhere, as well as decide whether the file is under source control in the first place, but it would work.

Cheers,

Dave Harrington.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Deleting a file programmatically

Post by lbauer » Mon Nov 10, 2008 3:52 pm

Hope this helps.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply