How to get Items in List

Hi All,

Below I am using Linq query where the variable Type CodeValuesList is of List Type(String). How can I get all the values of List as Output .

Hi @marina.dutta

You are doing the process right. When you use For each to iterate through list you will get the items that are in the list through message box.

Hope you understand!!


I am not getting any output. Its not going inside message box and printing values.

Please check your linq query then @marina.dutta


Hi @marina.dutta

Can you check the Output of list once

Are you looking for

or are you looking for inspecting the returned result?


That means CodeValuesList has no items, so you’ll have to evaluate why. It’s important to learn how to use Debug. Right-click the For Each, set a breakpoint, and then run in Debug. It’ll pause on the breakpoint and you can look at the variables on the left and see their values. Also, rather than use a Message Box, which means you have to click OK over and over, just use a Log Message. Then it’ll run all the way through and you can look in the Output panel to see the results.


Yes and my current linq query is giving Null . I want to get the CodeValueList values all the 6 items.

show us your output from immediate panel


when the namespace is not matching the value from the p element (text prefix one) then it is clear, why the list is empty. So correct the namespace value.

On how to find and on how to do was demonstrated in your other related topics


Here is my question. To get the namespace value , Instead of (205) can we take any random number like 1 or 10? I understand 205 is some random number to get Namespace , but what if I take 10 or 20 instead of 205? I should get the same Name space values ?

No we will not take any random namespace as we have to take the right one.

A random text:p element, not any random element

We can take / find the relevant namespace value by

  • catching the text:p element and retrieve it from Name.Namespace (recommended)


here we are looking for xmlns:text as text is the prefix from text:p elements


Got It. But what if I have daily different xml files which the bot has to read and then I can not hard code any Namespaces.

How to deal with different xml files where I need to get the Namespaces of each xml data ?

we should not try to put the variety of all possible XML scenarios, which can occur in the world, into one solution.

Your XML is bound to an office:document xml. You also have implemented to work with text:p elements

We can bring some flexibility into by:


1 Like


The thing is daily my bot runs and it downloads file which is of xml format and it has to extract 165 code from different xml files .So was asking this scenario

Your question is valid as it has to count to the requirements

But still we should consider the scope of this topic = 1 case (had empty list, fixed with correct namespace usage)

has to be specified:

  • A: different structures or
  • B: different files of the same structure

For B: we shared some increased flexible approaches above
For A: you have to handle additonal depending on the variations and is a different case


Below works for me.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.