Click or drag to resize

RepositoryGetJobs Method

Get a list of jobs from the repository

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.255.3501
Syntax
public IList<Job> GetJobs(
	Options options,
	params FileSpec[] files
)

Parameters

options
Type: Perforce.P4Options
options for the jobs commandJobsCmdFlags
files
Type: Perforce.P4FileSpec
list of files to filter jobs by

Return Value

Type: IListJob
A list containing the matching jobs
Remarks

p4 help jobs

jobs -- Display list of jobs

p4 jobs [-e jobview -i -l -m max -r] [file[revRange] ...]
p4 jobs -R

Lists jobs in the server. If a file specification is included, fixes
for submitted changelists affecting the specified files are listed.
The file specification can include wildcards and a revision range.
See 'p4 help revisions' for details about specifying revisions.

The -e flag lists jobs matching the expression specified in the
jobview parameter. For a description of jobview syntax, see 'p4 help
jobview'.

The -i flag includes any fixes made by changelists integrated into
the specified files.

The -l flag produces long output with the full text of the job
descriptions.

The -m max flag limits the output to the first 'max' jobs, ordered
by their job name.

The -r flag sorts the jobs in reverse order (by job name).

The -R flag rebuilds the jobs table and reindexes each job, which
is necessary after upgrading to 98.2. 'p4 jobs -R' requires that the
user be an operator or have 'super' access granted by 'p4 protect'.

Examples
To get a list of 100 jobs that include files under a given filepath:
FileSpec path = new FileSpec(new DepotPath(@"//depot/..."), null);
IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.LongDescriptions, null, 100)), path);
To get a list of 100 jobs with the status "open":
string jobView = "status=open";
IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.LongDescriptions, jobView, 100)), path);
To get a list of 10 jobs in reverse order:
IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.ReverseSort, null, 10));
To get a list of 10 jobs that include any fixes made by changelists integrated into the specified files:
FileSpec path = new FileSpec(new DepotPath(@"//depot/..."), null);
IList<Job> jobs = rep.GetJobs((new Options(JobsCmdFlags.IncludeIntegratedFixes, null, 10)), path);
See Also