Trying to read files from Folder

trying to read the file form Directory get files Feature but getting Error During automation in Document understanding .

Error ERROR Validation Error Compiler error(s) encountered processing expression “Directory.GetFiles(“C:\Users\sdullu\OneDrive - Capgemini\Documents\UiPath\OrchestrationProcess\NewInvoices”)”.
‘Directory’ is ambiguous, imported from the namespaces or types ‘Microsoft.Graph, System.IO’. testingPDF.xaml

Hello @shashank_dullu ,

can you show us what kind of variable/argument type you have for Document? (Variables tab)


Read this

Var type is the array of string
Documents = Directory.GetFiles ([string path], [string searchPattern(for example: “*.exe”)], System.IO.SearchOption.AllDirectories or TopDirectoryOnly)
About Search option:

AllDirectories - 1- Includes the current directory and all its subdirectories in a search operation. This option includes reparsing points such as mounted drives and symbolic links in the search.|
TopDirectoryOnly - 0 - Includes only the current directory in a search operation.

Here is an example:

Docs = Directory.GetFiles(“c:\temp”, “*.txt”,