SOLVED

How to query View Definition

%3CLINGO-SUB%20id%3D%22lingo-sub-1604992%22%20slang%3D%22en-US%22%3EHow%20to%20query%20View%20Definition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604992%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20hundreds%20of%20sites%20each%20having%20a%20specific%20document%20library%20with%20custom%20views.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20like%20to%20query%20the%20sites%2C%20identify%20the%20ones%20where%20the%20view%20is%20not%20correctly%20configured%20and%20fix.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ee.g.%20View%20is%20sorted%20on%20the%20wrong%20field.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20hints%20on%20how%20to%20achieve%20this%20via%20script%3F%26nbsp%3B%20pnp%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609917%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20query%20View%20Definition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609917%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4027%22%20target%3D%22_blank%22%3E%40Gilbert%20Okello%3C%2FA%3E%26nbsp%3BI%20have%20not%20done%20this%20myself%20but%20you%20might%20try%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-online%2Fget-sposite%3Fview%3Dsharepoint-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGet-SPOSite%3C%2FA%3E%20to%20get%20all%20the%20sites%20and%20then%20run%20this%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2Foffice%2FGet-all-views-from-a-f544f457%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Escript%3C%2FA%3E%20to%20get%20all%20these%20views%20and%20their%20properties.%3CBR%20%2F%3ERegards%2C%20Magnus%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1614231%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20query%20View%20Definition%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1614231%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F7661%22%20target%3D%22_blank%22%3E%40Magnus%20Goks%C3%B8yr%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat!%26nbsp%3B%20Thank%20you.%26nbsp%3B%20That%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

I have hundreds of sites each having a specific document library with custom views.

I would like to query the sites, identify the ones where the view is not correctly configured and fix.

 

e.g. View is sorted on the wrong field.

 

Any hints on how to achieve this via script?  pnp?

2 Replies
Best Response confirmed by Gilbert Okello (Frequent Contributor)
Solution

@Gilbert Okello I have not done this myself but you might try Get-SPOSite to get all the sites and then run this script to get all these views and their properties.
Regards, Magnus

@Magnus Goksøyr 

 

Great!  Thank you.  That works.