Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4018628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:00:24+00:00 2026-05-20T10:00:24+00:00

I am not an expert in P4.NET plugin, but I would like to show

  • 0

I am not an expert in P4.NET plugin, but I would like to show the existing workspaces for a user in a combo box, so that I can set the p4.Client to the selected workspace.

using (var p4 = new P4Connection())
            {
                p4.Connect();
                ???               
            }

How do I get the list of existing workspaces?
I think the command line to achieve this would be

p4 clients -m 100 -u username
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:00:24+00:00Added an answer on May 20, 2026 at 10:00 am

    Ok I have no choice than answering my own question, because the code would be too much to insert as comments to jhwist answer. Sorry jhwist. I had no choice.

    @appinger, I hope you find this answer helpful. Took me hours to figure out this api working. 🙂

    cmbBoxPerforceWorkspaceLocation is just your combobox for your workspaces. I am using Winforms by the way.

    I need to extract a shortname from the windows username. Windows username starts usually with xxxx\\username. In my code I extract the username out of the longname and save it as shortname. If your network is set differently this code might have to change accordingly.

    Let me know if it worked for you.

    using (var p4 = new P4Connection())
                {
                    p4.Connect();
                    var longName = WindowsIdentity.GetCurrent().Name;
                    var shortname = longName.Substring(longName.IndexOf("\\") + 1);
                    var records = p4.Run("clients", "-u", shortname);
    
                    cmbBoxPerforceWorkspaceLocation.Items.Clear();
    
                    foreach (P4Record record in records.Records)
                    {
                        cmbBoxPerforceWorkspaceLocation.Items.Add(record["client"]);
                    }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use Net::SSH::Expect in my unix box but unfortunately, it is not
I'm not very expert on how processors work, but one might imagine that it
I am not an expert but I am trying to write .NET regex expression
I'm not expert about css menus. But I know basic system to make css
I am not expert in ASP so i would be appreciated for the help.
I am not an expert in Git, but I have seen this done before
I am not an expert web-dev so please bear with me here. I would
I'm not a SQL expert (by any means). I know I can do this
I am not really an expert of .Net, I am trying to consume a
I really hope someone who is a CC.NET expert can help with this, because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.