Search code examples
c#mappingp4api.net

How to get local workspace mapping using p4api


All I want to know is the location of all the work-spaces which are created on user's local machine using p4api.

e.g. If user has mapped 'MyProject' workspace at location: "D:\LocalPerforce\MyWS" then I want to know this path -> "D:\LocalPerforce\MyWS"

I will be having user's necessary information. I came across GetClientFileMappings() but not sure how to user it Or it will help. How to achieve this in c#.


Solution

  • I achieved it with following code workaround:

    IList<Client> clients = rep.GetClients(new Options());
                    localPaths.AddRange(from client in clients
                                        where !string.IsNullOrEmpty(client.OwnerName) && client.OwnerName.Contains(User)
                                        select client.Root);