FolderItem versus FolderItem.NativePath

I have two FolderItems (f and CurrentDataSource) and I want to check if they point to the same location. When they actually do match, f = CurrentDataSource is False but f.NativePath = CurrentDataSource.NativePath is True.

Why? Should the direct comparison of FolderItems work? Or only their String Paths?

If … Then
…
'ElseIf f = CurrentDataSource Then 'this fails to match
ElseIf f.NativePath = CurrentDataSource.NativePath Then 'this matches
…
End If

This asks if both objects are the same object, which they are not.

This asks if the native path is the same, which is true.

No

Exactly :slight_smile:

Thank you for the explanation @Sascha_S

2 Likes