Link to home
Start Free TrialLog in
Avatar of Srinivas_Vengala
Srinivas_VengalaFlag for India

asked on

Getting the creator of a control

In Sharepoint, can we get the name of the user who has created a control (for ex, a list control)? I have not found anyway to get it.
Avatar of chapmanjw
chapmanjw
Flag of United States of America image

The only way to do this is directly from the SQL database.  These instructions are specific to 2010, however 2007 is similar (might just need to look at a different view or table):

1) Get the List ID.  You can do this by going to the list in the web browser and going to the List Settings.  The URL should have something like:

/_layouts/listedit.aspx?List=%7BC758FFC6%2DD14F%2D4820%2D8EE2%2D8805C1EE1B41%7D

%7BC758FFC6%2DD14F%2D4820%2D8EE2%2D8805C1EE1B41%7D is the List ID in a URL encoded format.  Remove %7B and %7D from the beginning and the end and replace the %2D's with hyphens (-).  In this example it would be: C758FFC6-D14F-4820-8EE2-8805C1EE1B41

2) With SQL Server Management Studio, connect to the SQL server for the SharePoint Site and goto the Content database for the site collection you are working with (something like WSS_Content, yada yada yada).

3) Query the dbo.Lists view where the tp_ID is equal to the List ID we just got.

For example:

SELECT *
  FROM [WSS_Content].[dbo].[Lists]
  WHERE [tp_ID] = 'C758FFC6-D14F-4820-8EE2-8805C1EE1B41'

4) Get the tp_Author value.  This is the SharePoint database ID for the user in question.

5) Query the dbo.UserInfo table where the tp_ID is equal to the author ID you just retrieved

For example:

SELECT *
  FROM [WSS_Content].[dbo].[UserInfo]
  WHERE tp_ID = '1073741823'

6) This may display multiple records, but it will all be the same user.  The tp_Login field will display the Active Directory account you are looking for.
I just verified and the 2007 database structure for this information is the same.  The above solution works for both versions.
Also, for SharePoint 2010 only, it is possible to get this with PowerShell.  Open up the SharePoint 2010 PowerShell and enter the following commands:

$web = Get-SPWeb "http://yoursiteurl"
$list = $web.lists["Your List Name"]
$listAuthor = $list.Author
Write-Host $listAuthor

This will display the AD account that created the specific list.
Avatar of Srinivas_Vengala

ASKER

I am sorry, I didn't get a chance to check your responses. I don't have access to SQL Server but I have have FULL CONTROL on our site in Sharepoint. It is Sharepoint 2007.
ASKER CERTIFIED SOLUTION
Avatar of chapmanjw
chapmanjw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial