ProcessCommandShare Difficulties

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

Moderator: SourceGear

Post Reply
rsprenkle
Posts: 1
Joined: Fri Oct 09, 2009 2:12 pm

ProcessCommandShare Difficulties

Post by rsprenkle » Fri Oct 09, 2009 2:40 pm

I have a method that iterates through a repository tree structure and creates a VaultClientFileColl of all the objects I want to share (and eventually pin) in a versioned tree structure in the same repository.

ex: share $/Project/A/foo.c to $/Versions/Project_1.2.3.4/A/foo.c

The idea is to merely loop through the File collection and create a target path by replacing $/Project with $/Versions/Project_1.2.3.4.

At first, I read the documentation, and it says that the target folder must exist, so I modified my code to do this. Everything OK so far. However, it still fails on the on ProcessCommand with the following exception:

No object was found at the repository path: $/Versions/Simulator_1.1.1.10/SimLogWindow/SimLogWindow.csproj

Here's the exact code:Note:
SourcePath = $/SimulatorTip/SimLogWindow/SimLogWindow.csproj <Confirmed that this exists>
TargetPath = "$/Versions/Simulator_1.1.1.10/SimLogWindow/SimLogWindow.csproj"
RepoPath $/Versions/Simulator_1.1.1.10/SimLogWindow <as pasted from client to make sure no typo>

I can get this call to work on a folder, but not a file. I can do this manually, but not with the API currently...
I attached a png of our Vault Client so you can see the source / target exist

foreach (VaultClientFile file in files)
{
string SourcePath = file.FullPath ;
string TargetPath = SourcePath.Replace(Source,Target);

ServerOperations.ProcessCommandShare(SourcePath,TargetPath); //exception thrown here
ServerOperations.ProcessCommandPin(TargetPath,-1);
}
Attachments
VaultShareAPI.png
Picture of Client showing tree layout
VaultShareAPI.png (8.78 KiB) Viewed 5298 times

paulroub
Posts: 29
Joined: Mon Nov 19, 2007 2:49 pm
Location: Champaign, IL
Contact:

Re: ProcessCommandShare Difficulties

Post by paulroub » Mon Oct 12, 2009 10:15 am

ProcessCommandShare expects the target to be a folder.

So in your case, it looks like the code should be:

Code: Select all

  // assuming Target contains $/Versions/Simulator_1.1.1.10/SimLogWindow/

  string SourcePath = file.FullPath ;
  string TargetPath = SourcePath.Replace(Source,Target);

  ServerOperations.ProcessCommandShare(SourcePath,Target); 
  ServerOperations.ProcessCommandPin(TargetPath,-1);
Think of it as "Share into", not "Share as".
Paul Roub
SourceGear

Post Reply