Feb 05

Doing the platypus with Sharepoint databases

Tag: Systems — Joaquim Anguas @ 7:36 pm

If you have tried to move a MS Sharepoint site that contains Team Discussions, you may have found that owner/editor fields get wrong values. There is a bug in the export/import and using option «-includeusersecurity» at stsadm does not help.

If you want to get the site moved I found no other way that to modify the sharepoint database by hand.

It may seem crazy, but you don’t have to dig under the mud in the river (that’s what platypus do; that’s why I named this post like this) to find what you have to modify, I did that for you.

You need to know your users’ ids. Go to table dbo.UserInfo and get the tp_ID corresponding to the tp_Title you want to change. Or, when you roll your mouse over a username in your Sharepoint site you see a link like this https://test.bobo.com/test/_layouts/userdisp.aspx?ID=15 : ID=15 is the user ID.

Then you need to find the items you want to change. Team Discussions items are stored at dbo.AllUserData. There’s a row for every item:

  • tp_SiteId stores the site id
  • tp_ListId stores the list id
  • tp_ID is the identifier for the item inside the list inside the site

You want to modify fields tp_Author and tp_Editor.
Copying the table itself doesn’t do the trick because all ids get regenerated in the import process.

An update query could look like this:

UPDATE [WSS_Content_9586fdfdd9054344a2ee057173be74cd].[dbo].[AllUserData]
SET tp_Author = 15
WHERE (tp_ID = 146) AND
(tp_ListId = ‘4F390D64-38DF-49CD-88CF-2E5EE060E28C’) AND
(tp_SiteId = ‘B1DF81FA-8292-4A67-86C2-A227196E4C38’);

Once you are familiar with the structure, you can do some queries in the origin Sharepoint database and automate the whole change, as I am doing right now. I will post the whole process.

I hope this helps…