Tuesday, March 3, 2009

Sharepoint 2007 Content Database Structure




Content DataBase Structure

Important Tables in Content Databse

Features: Table holds information about all the activated features for each site collection or site. Sites : Information about all the site collections for this content database.
Webs: Information about all the specific sites (webs) in each site collection.
UserInfo: Information about all the users for each site collection.
Groups:Information about all the SharePoint groups in each site collection.
Roles: Information about all the SharePoint roles (permission levels) for each site.
AllLists: Information about lists for each site.
AllDocs: Table that holds information about all the documents (and all list items) for each
AllUserData: Information about all the list items for each list.
RoleAssignment: Table that holds information about all the users or SharePoint groups that are assigned to roles.
GroupMembership: Table that holds information about all the SharePoint group members. document library and list.
I'll update some details of other tables very soon.

**** Note: Dont Update any any content Database table directly . It is not recommended.

Some Important Queries

-- Query to get all the top level site collections
SELECT SiteId AS SiteGuid, Id AS WebGuid, FullUrl AS Url, Title, Author, TimeCreatedFROM dbo.WebsWHERE (ParentWebId IS NULL)-- Query to get all the child sites in a site collectionSELECT SiteId AS SiteGuid, Id AS WebGuid, FullUrl AS Url, Title, Author, TimeCreatedFROM dbo.WebsWHERE (NOT (ParentWebId IS NULL))

-- Query to get all the SharePoint groups in a site collection
SELECT dbo.Webs.SiteId, dbo.Webs.Id, dbo.Webs.FullUrl, dbo.Webs.Title, dbo.Groups.ID AS Expr1, dbo.Groups.Title AS Expr2, dbo.Groups.DescriptionFROM dbo.Groups INNER JOINdbo.Webs ON dbo.Groups.SiteId = dbo.Webs.SiteId

-- Query to get all the users in a site collectionSELECT dbo.Webs.SiteId, dbo.Webs.Id, dbo.Webs.FullUrl, dbo.Webs.Title, dbo.UserInfo.tp_ID, dbo.UserInfo.tp_DomainGroup, dbo.UserInfo.tp_SiteAdmin, dbo.UserInfo.tp_Title, dbo.UserInfo.tp_EmailFROM dbo.UserInfo INNER JOINdbo.Webs ON dbo.UserInfo.tp_SiteID = dbo.Webs.SiteId

-- Query to get all the members of the SharePoint GroupsSELECT dbo.Groups.ID, dbo.Groups.Title, dbo.UserInfo.tp_Title, dbo.UserInfo.tp_LoginFROM dbo.GroupMembership INNER JOINdbo.Groups ON dbo.GroupMembership.SiteId = dbo.Groups.SiteId INNER JOINdbo.UserInfo ON dbo.GroupMembership.MemberId = dbo.UserInfo.tp_ID




No comments: