Checking in Selected Files

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

Moderator: SourceGear

Post Reply
gregg1022
Posts: 5
Joined: Tue Oct 28, 2008 1:45 pm

Checking in Selected Files

Post by gregg1022 » Wed Jul 29, 2009 8:59 am

I am using the api VaultClient 3.1.9
I am trying to figure out the correct way to check selected files in and out. I am able to check out the files I select although I am not so sure it is the best way to do it so your input on this would be appreciated also. However I can't figure out how to check them back in. I included a snippet below of how I am attempting to do it.

For Each Item As DataGridViewRow In Me.GridRepositoryFiles.SelectedRows
ReDim Preserve FileList(I)
FileList(FileList.Length - 1) = Me._VaultSession.GetRoot.FindFileRecursive(Item.Cells(0).Value) -- the cell value is the file id
Next
Me._VaultSession.Get(FileList, True, VaultClientOperationsLib.MakeWritableType.MakeAllFilesWritable, VaultClientOperationsLib.SetFileTimeType.Current, VaultClientOperationsLib.MergeType.AttemptAutomaticMerge, P) (it does not seem to make them writeable)

Me._VaultSession.CheckOut(FileList, 2, "Check Out") ----the check out works


(here I want to check them back in but the only way I see is to get all the items changed and then select from the collection what I want to commit. Is this how it is done? Also could you include the line of code that does the actuel check in?)

Dim ChangedItems As VaultClientOperationsLib.ChangeSetItemColl = _VaultSession.InternalChangeSet_GetItems(True)
?? line of code to do the actual check in


Thanks for your help

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

Re: Checking in Selected Files

Post by jeremy_sg » Thu Jul 30, 2009 10:10 am

You're right, the way to do it is to get the internal change set, and create a new changeset which has only the items that you want to commit.

Then you call the ClientInstance.Commit() method with that new change set.
Subscribe to the Fortress/Vault blog

Post Reply