Question

I want to know if below proprieties are enabled or disabled for any SharePoint 2013 List/Library. How we can get using SQL Query from ContentDB (AllLists Table), which column I have to use in my query?

  • EnableVersioning
  • UniqueItemPermissionsEnabled

As we know if we want the result of lists using SQL query which are not deleted from site we can use below query:

SELECT * FROM AllLists  WHERE tp_DeleteTransactionId = 0x

Similar way I want the result set using SQL query where above two properties are enabled or disabled

Thanks, Viren

Was it helpful?

Solution 3

We have to add below SQL conditions to get the EnableVersioning and UniqueItemPermissionsEnabled values using SQL Query from Content DB

CASE  
WHEN (tp_Flags & 0x0000000000000080) > 0 THEN 'TRUE' 
ELSE 'FALSE' 
END AS EnableVersioning,  

CASE  
WHEN tp_HasFGP = 1 THEN 'TRUE'  
ELSE 'FALSE'  
END AS UniqueItemPermissionsEnabled, 

Extra Information


DeleteVersions ||> 0x0000000000000080 ||> Allow deletion of past versions of a list item or document. ^Link^


0x0000000000000080 ||> This list has versioning enabled, and supports creating historical versions of list items when changes occur. This bit MUST be ignored for Lists with a List Base Type of survey. ^Link^

OTHER TIPS

As this is part of the SharePoint list schema, it is compressed in the tp_Fields column. Unfortunately there is no public documentation as to how to decompress this value into something you can use. And as Thriggle points out, you should be using the SharePoint OM. If you're dead-set on making SELECT queries, always use WITH (NoLock).

You should not run your own SQL queries against the SharePoint database for multiple reasons. According to Microsoft:

Direct modification of the SharePoint database or its data is not recommended because it puts the environment in an unsupported state.

If a server component requires information from the database, it must get that data by using the appropriate items in the SharePoint object model, and not by trying to get the items from the data structures in the database through some query mechanism.

Instead of using a SQL query to retrieve the data you want, you should use the SharePoint object model, either from one of your web front end servers using Powershell or .NET code (server side), or from another computer using the client object model (such as the available web services and REST services, or the .NET or JavaScript client object models).

A Powershell script run from a web front end server is probably the simplest option for a one-time report. I recommend asking a new question if you need help with the syntax or specifics of running a Powershell script to query SharePoint.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top