Represents a Perforce 'Form' object.
For a list of all members of this type, see P4Form Members.
System.Object
P4API.P4Record
P4API.P4Form
Forms are the things that pop-up in an editor when run from a command line. In P4.Net (and most other Perforce APIs), you do not need to parse/format the text manually. Instead, you can get/set the fields using the Fields and ArrayFields collections.
The following is a list of common form commands:
When fetching or saving a form, do not use the '-o' and '-i' flags. P4.Net will automatically include them.
The following example updates the current client. It changes the client root, and adds a line to the view.
P4Connection p4 = new P4Connection(); p4.Connect(); P4Form MyClient = p4.Fetch_Form("client"); //Change the root and properties MyClient["Root"] = @"C:\p4\P4.NetClient"; MyClient["Description"] = "Created from P4.Net!"; //Fetch the clientName (for use later in building the view spec). string clientName = MyClient["Client"]; // Build a new array, that has one more element than the current view string[] NewView = new string[MyClient.ArrayFields["View"].Length + 1]; // Copy the existing view lines to the new array MyClient.ArrayFields["View"].CopyTo(NewView,0); // Set the new view line NewView[NewView.Length - 1] = string.Format("//depot/newpath/... //{0}/newpath/...", clientName); MyClient.ArrayFields["View"] = NewView; // Save the form P4UnParsedRecordSet MyResult = p4.Save_Form(MyClient); p4.Disconnect();
Namespace: P4API
Assembly: p4api (in p4api.dll)
P4Form Members | P4API Namespace