Questions about a method in GetOperations class

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

Moderator: SourceGear

Post Reply
louis.kwong
Posts: 2
Joined: Mon May 19, 2008 2:55 am

Questions about a method in GetOperations class

Post by louis.kwong » Mon May 19, 2008 3:10 am

Hi,

Just want to see whether someone can help me, as I am trying to find out the significance of each parameters for this method:

ProcessCommandGetLabelToLocationOutsideWorkingFolder(string objectPath, string label, string labelSubItem, GetOptions getOptions, string destPath)

Especially the significance of the third parameter (string labelSubItem). Diving into the metadata of the GetOperations class in VS, I see that this third parameter is recommended to be set to "null".

- Why does it need to be "null"?
- If the third parameter is NOT "null", will this method still behave exactly the same as if the parameter is "null"?

The reason is because in the past we have been using this method in one of our applications at work by passing a third parameter that could be "null" or NOT "null". However, recently this application has stopped working and spitting out an exception. We tracked it down to this method. If I change the third parameter to "null" now, I can fix the issue and the application will return to normal. However, we feel intrigued why this method suddenly stopped working with our original parameter.

shannon

Post by shannon » Mon May 19, 2008 9:42 am

It's "The inside-the-label path of the item (file or folder) that you want".

In the API usage of a get, null is always ok. The real reason to use it if the item your getting is not the same name or location in the current tree and the label.

For example, if my label "BOB" looks like this:

$/labelme/renameme.txt

and the current tree looks like:

$/labelme/igotrenamed.txt

then to get just the file in the label, my get would have to look like this:

ProcessCommandGetLabelToLocationOutsideWorkingFolder("$/labelme", "BOB", "renameme.txt", whatever, whatever)

This one is wrong, since it won't be able to find the file in the current tree:

ProcessCommandGetLabelToLocationOutsideWorkingFolder("$/labelme/renameme.txt", "BOB", null, whatever, whatever)

Since this happens very infrequently (most gets are on the root of the label), null is almost always the right choice.

So I suppose the question to start with would be: has something changed in your tree to make the value of that third parameter incorrect, maybe a rename or delete?

Post Reply