Click or drag to resize

RepositoryGetOpenedFiles Method

Return a list of Files opened by users / clients.

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.255.3501
Syntax
public IList<File> GetOpenedFiles(
	IList<FileSpec> filespecs,
	Options options
)

Parameters

filespecs
Type: System.Collections.GenericIListFileSpec
options
Type: Perforce.P4Options

Return Value

Type: IListFile
Remarks

p4 help opened

opened -- List open files and display file status

p4 opened [-a -c changelist# -C client -u user -m max -s] [file ...]
p4 opened [-a -x -m max ] [file ...]

Lists files currently opened in pending changelists, or, for
specified files, show whether they are currently opened or locked.
If the file specification is omitted, all files open in the current
client workspace are listed.

Files in shelved changelists are not displayed by this command. To
display shelved changelists, see 'p4 changes -s shelved'; to display
the files in those shelved changelists, see 'p4 describe -s -S'.

The -a flag lists opened files in all clients. By default, only
files opened by the current client are listed.

The -c changelist# flag lists files opened in the specified
changelist#.

The -C client flag lists files open in the specified client workspace.

The -u user flag lists files opened by the specified user.

The -m max flag limits output to the first 'max' number of files.

The -s option produces 'short' and optimized output when used with
the -a (all clients) option. For large repositories '-a' can take
a long time when compared to '-as'.

The -x option lists files that are opened 'exclusive'. This option
only applies to a distributed installation where global tracking of
these file types is necessary across servers. The -x option implies
the -a option.

Examples
To get a maximum of 10 opened files from the repository, opened by user fred, opened with any client:
FileSpec fs = new FileSpec(new DepotPath("//..."), null);

List<FileSpec> lfs = new List<FileSpec>();
lfs.Add(fs);

// null for changelist and client options
GetOpenedFilesOptions opts =
new GetOpenedFilesOptions(GetOpenedFilesCmdFlags.AllClients,
null, null, "fred", 10);

IList<File> target = Repository.GetOpenedFiles(lfs, opts);
See Also