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 7716995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:46:20+00:00 2026-06-01T02:46:20+00:00

I met KeyNotFound exception when i’ve tried to query the user list in rally

  • 0

I met KeyNotFound exception when i’ve tried to query the user list in rally rest .net api. The example code is following:

Request query = new Request("User");
query.Workspace = workspaceRef;

var response = api.Query(query);

The detail of exception is : “The given key was not present in the dictionary.” and its stack traces:

at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Rally.RestApi.DynamicJsonObject.GetMember(String name)
at Rally.RestApi.RallyRestApi.Query(Request request)

Please advise me the proper way to query a list of users of the workspace.

BTW, is there any way to get a list of users who has permission to access a project in Rally Rest .NET api?

Many thanks for ur helps.

  • 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-06-01T02:46:21+00:00Added an answer on June 1, 2026 at 2:46 am

    your syntax looks Ok. Where are you seeing the “…key was not present…” error occur? When accessing the Results collection?

    I’m including a code sample below that illustrates querying for users within a Subscription and summarizing their Workspace and Project Permissions. I hope this helps.

            // Query for User
            Request userRequest = new Request("user");
            userRequest.Fetch = new List<string>()
                {
                    "UserName",
                    "Subscription",
                    "DisplayName",
                    "UserPermissions"
                };
    
            userRequest.Query = new Query("");
            QueryResult queryUserResults = restApi.Query(userRequest);
    
            String userName;
            String displayName;            
            String mySubscriptionRef;
            String mySubscriptionName;
    
            // Fetch strings to pull in Subscription and UserPermission metadata
            string[] subscriptionFetch = { "Name", "SubscriptionID", "CreationDate" };
            string[] userPermissionFetch = { "Name", "Role", "Workspace", "Project" };
            string[] workspaceFetch = {"Name", "Description"};
    
            foreach (var result in queryUserResults.Results)
            {
                userName = result["UserName"];
                displayName = result["DisplayName"];
                var mySubscription = result["Subscription"];
                mySubscriptionRef = mySubscription["_ref"];
    
                // Query by Workspace Ref.
                var mySubscriptionFetched = restApi.GetByReference(mySubscriptionRef, subscriptionFetch);
                mySubscriptionName = mySubscriptionFetched["Name"];
    
                Console.WriteLine("Username: " + userName);
                Console.WriteLine("Display Name: " + displayName);
                Console.WriteLine("Subscription: " + mySubscriptionName);
    
                var myUserPermissions = result["UserPermissions"];
    
                // Loop through UserPermissions Collection
                foreach (var thisPermission in myUserPermissions)
                {
                    // Grab UserPermission ref
                    var myUserPermissionRef = thisPermission["_ref"];
                    // Query from UserPermission ref
                    var myUserPermissionFetched = restApi.GetByReference(myUserPermissionRef, userPermissionFetch);
                    // Output project name
                    Console.WriteLine("         Role: " + myUserPermissionFetched["Role"]);
    
                    // Try Workspace ref
                    try
                    {
    
                        var myWorkspace = myUserPermissionFetched["Workspace"];
                        var myWorkspaceRef = myWorkspace["_ref"];
    
                        // Query from Workspace ref
                        var myWorkspaceFetched = restApi.GetByReference(myWorkspaceRef, workspaceFetch);
    
                        // Output Workspace data
                        Console.WriteLine("         Workspace Name:" + myWorkspaceFetched["Name"]);
    
                    }
                    catch (KeyNotFoundException knfe)
                    {
                        Console.WriteLine("Key not found: " + "Workspace");
                    }
    
                    // Try Project ref
                    try
                    {
    
                        var myProject = myUserPermissionFetched["Project"];
                        var myProjectRef = myProject["_ref"];
    
                        // Query from Workspace ref
                        var myProjectFetched = restApi.GetByReference(myProjectRef, workspaceFetch);
    
                        // Output Project data
                        Console.WriteLine("         Project Name:" + myProjectFetched["Name"]);
                    }
                    catch (KeyNotFoundException knfe)
                    {
                        Console.WriteLine("Key not found: " + "Workspace");
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I met an interesting issue about C#. I have code like below. List<Func<int>> actions
Recently I met a strange problem, see code snips as below: var sqlCommand: string;
In Programming Pearls I have met the following problem. The question is this: print
I met a problem caused by the tricky Indentation, here is the code looks
I met a issue with LTS My code as below: return from p in
I met this weird problem, and I tried a whole afternoon to solve this,
I met exception when using annotated joined subclass, i don't know how to correct
Have you guys met something similar? Exception type: System.ComponentModel.Win32Exception Exception message: The operation completed
I am doing the Nerd Dinner tutorial for ASP.NET MVC and I met one
In some project i met this code: erb = yield.src I can't understand what

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.