How do I access a saved StarTeam query via the SDK?

177 views Asked by At

I have a saved public query (created via the StarTeam UI).

Rather than recreate it programmatically via the SDK (which is cumbersome), I'd like to be able to create a QueryInfo object based on the saved public query. The QueryInfoFactory seems only able to create new QueryInfo objects and provides no mechanism to load an existing query.

1

There are 1 answers

0
Slapout On

You don't mention what language you're working with. In .NET, I think you could do something like this:

String lockedQueryName = "GetLockedFilesQuery";
Borland.StarTeam.Type ftType = STProject.DefaultView.Server.TypeForName(STProject.TypeNames.FILE);
STProject.DefaultView.Server.RefreshTypes();
Query query = ftType.Queries.FindByName(lockedQueryName, true); 

Where lockedQueryName is the name of your saved query. And STProject is of type Borland.StarTeam.Project and set to your project.