Get Date modified for XML file

Hi,

I have a workflow where I put for each file in certain directory. There I have few files and I only have to get the “Date modified” for xml file. When I set TypeArgument to XDocument it says that Get.LastWriteTime is not a member

Hi, check if the below function works
Directory.GetLastAccessTime(file).ToShortTimeString

Nope, it shows the same error

What type is your file? It should be string.

Cheers

1 Like

I have different files in a folder and I have to get date modified only for the XML file

I mean “file” variable you use in ForEach…
See the picture

then how do I get it only for xml file if type is string?

The method “Directory.GetFiles(…)” returns in array of string file names.
Therefore “file” should be also string type variable.
It has nothing to do with what “file names” will be selected.

The other likely problem is confusion of “file” variable and “file” class
image

Better use different name for the variable, e.g. “f”
image

Cheers

@markosc
Try below once
ile.GetLastWriteTime(“varPath”).ToShortDateString