Query for files based upon container

Highlighted
Deleted
Not applicable

We have libraries that have specified folder structures (Lib1 -> Folder A, Lib1 -> Folder 2). We are intentionally not using Document Sets. We set the default values for two columns of each file when it is added to the folder using standard document library capabilities (LibaryColumn = Lib1, FolderColumn = Folder A). I want to make sure that if a file is accidentally put in Lib1 -> Folder B then moved to Lib1 -> Folder A, it's FolderColumn is accurate because it won't automatically update. I do not want to do this using an event receiver. I would like to have a script that queries my libraries for files that have FolderColumn values that do not match their containing folders. It would be great if I could also have the same query do an "OR" to determine if their LibraryColumn doesn't match the Library they are in. I would want to do this so that I can a) avoid remote event receivers because we have had those fail in the past and b) when doing this audit I don't want to have to cycle every file in every library. Any suggestions would be appreciated. 

0 Replies