Error with PDF GetExtension Activity

Hi, I am trying to get the PDF file extension by using “Path.GetExtension(item)”. I keep getting the error message below:

"18.4.1+Branch.master.Sha.bc66386dd8e2160b6d35f31d5ce934a5aa4cf4bd

The workflow has validation errors. Review and resolve them first.

Compiler error(s) encountered processing expression “Path.GetExtension(item).ToString.ToLower”.
‘GetExtension’ is not a member of ‘String’."

I have no issues with this until I added a multiple page navigation flow after it. Not sure if that is the cause but can anyone assist on this? I have added some visuals for your reference. Thank you!

AddedFlow_1 AddedFlow_2 AddedFlow_3 AddedFlow_4 Error

Hi,

I might be wrong here, but, here is a sugestion, from documentation it seems that Path.GetExtension already returns a string, so there might be no need to use the ToString method. Also, please check the type of the “extension” var it should also be a string.

Hope this helps,
Daniel

Hi Daniel, thanks for the prompt reply. Currently I am not using the ToString method.

Under Assign, what I did was to assign the variable extension = Path.GetExtension(item)

However, when I type “Path.” I could not see the function “GetExtension” (as shown below)

Screenshot%20(59)

How do I check what functions I have?

Try Capital G, also do pay attention to capitalized non capitalized letters the name of the method is " Path.GetExtension" notice the P G and E

Have tried to do as advised, but I am still seeing the same error (see below)

Ok, let’s try it another way, try to print to the console the type of item, if the type is not string you should somehow to get the file name as a string. Again please have a look at the documentation for Path.GetExtension

@Asyura did u diclare path as variable?

Well it is my understanding that “Path” is a class on its own in C# (have a look here)

Yeap, I figured that I had declared “path” as a variable. After removing it, it works as per normal. Thank you @Manjuts90 @daniel_cornea!

2 Likes

Close thread marking appropriate answer as solution