Tuesday, April 28, 2009

Sharepoint My Site "The File Exists" Error - AD User recreation issue with my site

Root Cause Of the Issue
when an AD deleted and recreated user try to access their "my site", they will receive "The File Exists" error

Solution 1- Using Sharepoint Administration

a. Go to SharePoint Central Administration site.
b. On the SSP admin page, select "User profiles and properties" "View User Profiles"
c. Search for the user . Click user name and select "Manage Personal Site"

Remove user from the site collection
a. Click "People and Groups"

b. In the "Groups" section, click on the "Owners" group

c. Check the user and select "Actions Remove Users from Group"

Repeat (a) - (c) for each group.

d.Click "Site Permissions" and select "Settings Site Collection Administrators"
e. Add the farm account as a site collection adminsitrator and delete/remove the user.
f. In "People and Groups" screen, click "People" and delete/remove user.

Add the user to the site collection
a. Click "Site Permissions"
b. Select "Settings Site Collection Administrators"
c. Add the user as a site collection adminsitrator. delete the farm account that was added in the previous steps.


if you have guts and confident to play with sharepoint content DB then you will love following alternative way.

Solution 2

Run the following script in the SQL Server against my site's content database (ex: wss_content_Mysite)

To see the list of site url and and there site id you can run the following script

select s.id,w.fullurl from sites s inner join webs w on s.rootwebid = w.id

Following script will do the trick

declare @idVal varchar(200),@sidOldVal varchar(200),@sidNewVal varchar(200)

--Following line will return the site id for the mysite
set @idVal = select s.id from sites s inner join webs w on s.rootwebid = w.id and w.fullurl = "personal/shyjumohan" -- Mysite url

--following line will return old sid value for the user,here we are selecting the sid based ion mysite id and username so it will return the old value .User can be there for multiple site so the top 1 is used

set @sidOldVal = select top1 tp_systemid from userinfo where tp_login = 'ustr\shyjumohan' and tp_siteid = @idVal --tp_login = 'Domain\username'

--following line will return new sid of the user,here we omitted old sid
set @sidNewVal = select top1 tp_systemid from userinfo where tp_login = 'ustr\shyjumohan' and tp_systemid != @sidOldVal --tp_login = 'Domain\username'

select @sidOldVal, @sidNewVal

--make sure you r getting proper value then un comment the following line and run it
--update userinfo set tp_systemid = @sidNewVal where tp_systemid =@sidOldVal

its intresting write?:)