I assume that you not run this code from the server. In order to change file you need to do the folowing steps.
Sync your workspace (using p4v you will get the command).
Create changelist
//creation of new changelist public Changelist CreateNewChangelistInWorkspace(string workspace_name, string change_description) { Repository rep = P4Core.Instance.GetRepository(workspace_name); Client client = rep.GetClient(workspace_name); client.Host = string.Empty; rep.UpdateClient(client); //creating changelist Changelist cl = new Changelist(); cl.Description = change_description; cl.ClientId = workspace_name; cl = rep.CreateChangelist(cl); return cl; }
edit your files - The files locate in your computer now so you not need perforce for edit.
reconcile (p4v will give you the command) (and will attach the files to the change list created in step 2).
submit the changelist (changelist.submit()) + repository.updatechangelist(changelist)).