SharePoint Get List Item Filter With Special Characters

Hi,

I have a column field as Folder URL in SharePoint List where I store the URL as a string.

My Use Case: I get the uploaded file’s parentUri and aim to find the target list item based on that folder URL with the filter.

I used the single list item with a filter for the Folder URL field, using the same variables. The item returns null.


The image shows an expandable list item labeled "spEmpItem" with the value "null" underneath it. (Captioned by AI)

To check if the URLs are the same, I got the single list item by the ID and compared the Folder URL field with the uploadedFile.ParentUri. And URLs are equal.

Then, I tested the special characters separately. / and % are not a problem if they used as single characters e.g. “test/test” or “test%test”.

But it’s a problem when the % is followed by 20 to represent the whitespace character, e.g., “test%20test.” The URL uses this usage several times, and it’s not filtering the item I have. I tried to escape the “%” character; it didn’t work.

I would be very happy if you could give me a solution or workaround for that.

PS: Getting all list items and filtering the result is the last option for me. And please don’t suggest me to try random solutions that you didn’t test.

Thank you,
Best regards.

Maybe you are looking for this:
grafik

I tried using it inside the filter: Same result - null

The uploadedFile.ParentUri already returns with %20 and other character codes for char “ı”
image
This is the URL text on the SharePoint List
image

@sarikayaebru
Have sent you a PM

Also check if the

  • the column is an indexed column or not
  • if a filter on another indexed column is working or not

Background: we observed in the past an issue sourced by this

@sarikayaebru
Also give a try at:
grafik

1 Like

Yes, this worked! Since the problem was the % character I tried the replace method. But Uri.EscapeDataString will also protect the code for other possible special characters.

Thank you very much for your support @ppr

1 Like

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