I know that if I find my required data/information from SharePoint database then there must be some way to find same thing from object model. So I started debugging SPFile object and tried to see what are the properties exposed by object model, but I didn’t see any properties from code, then I have found some hidden properties which match with ALLDOCS table schema, properties names are "vti_hasdefaultcontent", "vti_setuppath", so after using those hidden SPFile properties, I got my results which match with query results,
Example Code:
SPFile objFile;
string bDefaultContent = (string)objFile.Properties["vti_hasdefaultcontent"];
string strSetupPath = (string)objFile.Properties["vti_setuppath"];
if (strSetupPath == null && bDefaultContent == null)
{
//If code executed and comes into this loop then current Page/File status is customized
//then I can take objFile.File and objFile.URL values
}
Reference Links:
I have found one hidden property name from object model for checking page/site customization
http://stsadm.blogspot.com/2007/09/re-ghosting-pages.html
Hidden Property name from file object
http://www.eggheadcafe.com/conversation.aspx?messageid=29277607&threadid=29254168
Comments are always welcome!!!
Showing posts with label How to find page customization status. Show all posts
Showing posts with label How to find page customization status. Show all posts
Friday, May 29, 2009
How to find page/site customization status – Part 2 – with the help of SharePoint object model
How to find page/site customization status – Part 1 – with the help of Content Database Schema
Till now, that was one of my toughest assignment, my requirement was to find all pages which customized or changed from SharePoint designer, visual studio and any editor tool, when I started working on the requirements, I thought that I can easily find page customized status (ghosted/unghosted) from SharePoint object model - page CustomizedPageStatus enumeration, but that flag gave me wrong value, I mean, I can’t see my pages as customized which I created from SharePoint Designer.
At one time, I don’t know what to searched in Google, because I tried all combination of search query to get some useful output, but It didn’t bring me anything, all search result gave me idea and links about ghosting, how to customize page and how to reset to site definition from SharePoint designer, etc…..
After some time, I have found one link which says how to deal and work with SharePoint content database, so I started playing around with content database and I have found out that I can write a query which will give me page customization status, SharePoint stores all the information into database, “ALLDOCS” table has all information regarding page size, version, attached list, modified user, time and many more ….
By looking into schema for ALLDOCS table, I created database query and finally I got my result and I was so happy to see the result :)
Below is sample query which will give us all the pages which customized/created from SharePoint Designer, Visual Studio or any other editor tool.
QUERY:
SELECT
W.Title, W.FullURL,
D.DirName + '/' + D.LeafName as pageName,
TimeLastModified as ModifiedTime,
*
FROM
Alldocs D With (NoLock)
JOIN Webs W With (NoLock)
On W.ID=D.WebID
WHERE
D.hasstream = '1'
and D.extension = 'aspx'
and D.iscurrentversion = '1'
and D.setuppath is NULL
Reference Links:
ALLDOCS table schema – columns and its description
http://msdn.microsoft.com/en-us/library/cc704495.aspx
Database table information to find page customized status
http://sky-soft.net/SkySoft/Documentation/WSS/WSSv3Notes.htm
Information about SharePoint content database
http://www.sharepointu.com/ethan/archive/2007/09/16/inspecting-the-sharepoint-content-database.aspx
Query to find list of documents from site collection
http://stackoverflow.com/questions/213801/sharepoint-2007-sql-query-to-find-a-list-of-documents-in-site-collection
After finding my result from database, I thought to tried into SharePoint object model, here is link for finding page customization status from object model.
At one time, I don’t know what to searched in Google, because I tried all combination of search query to get some useful output, but It didn’t bring me anything, all search result gave me idea and links about ghosting, how to customize page and how to reset to site definition from SharePoint designer, etc…..
After some time, I have found one link which says how to deal and work with SharePoint content database, so I started playing around with content database and I have found out that I can write a query which will give me page customization status, SharePoint stores all the information into database, “ALLDOCS” table has all information regarding page size, version, attached list, modified user, time and many more ….
By looking into schema for ALLDOCS table, I created database query and finally I got my result and I was so happy to see the result :)
Below is sample query which will give us all the pages which customized/created from SharePoint Designer, Visual Studio or any other editor tool.
QUERY:
SELECT
W.Title, W.FullURL,
D.DirName + '/' + D.LeafName as pageName,
TimeLastModified as ModifiedTime,
*
FROM
Alldocs D With (NoLock)
JOIN Webs W With (NoLock)
On W.ID=D.WebID
WHERE
D.hasstream = '1'
and D.extension = 'aspx'
and D.iscurrentversion = '1'
and D.setuppath is NULL
Reference Links:
ALLDOCS table schema – columns and its description
http://msdn.microsoft.com/en-us/library/cc704495.aspx
Database table information to find page customized status
http://sky-soft.net/SkySoft/Documentation/WSS/WSSv3Notes.htm
Information about SharePoint content database
http://www.sharepointu.com/ethan/archive/2007/09/16/inspecting-the-sharepoint-content-database.aspx
Query to find list of documents from site collection
http://stackoverflow.com/questions/213801/sharepoint-2007-sql-query-to-find-a-list-of-documents-in-site-collection
After finding my result from database, I thought to tried into SharePoint object model, here is link for finding page customization status from object model.
Subscribe to:
Posts (Atom)