简单

导航

关于恢复被修改的dispform.aspx(moss)

  在开发moss时,经常用定制dispform.aspx,但是这个页面如果删除默认的控件问题就大了,搜索器搜索不到,AllItems.aspx里的链接错误,反正是问题多多,如果还没有修改,那就恭喜你了,不过不改也有问题,你没有办法定制显示页面,毕竟原来的页面太难看,最好的方法是隐藏原来的控件,你重新拖一个定制控件进去。具体方法不再详细说。我想说的是如果你是一个新手,象我一样不知好歹删除了原来的控件,并且已经做好了,输入了大量的数据,看起来还很美滋滋很有成就感,突然发现allitems.aspx里的链接不管用了,搜索也不行了,找了微软的方法是,让你删除重建一个,我的天,两天时间白费了。

 

  现在有一个简单而危险的方法,就是修改数据库,主要有一个表,一个是alldocs 和 webparts,你通过在list页面的url参数找到Listid,应该是一长串的guid值,然后可以通过在这值查询这个两表的记录,你会发现在webparts里缺少dispform.aspx记录(看你是删除了哪一个页面的默认控件了),然后通过以下脚本添加一行记录,tp_id值可以通过guid生成器生成,其他值可以在相似的记录里找到,关键是tp_PageUrlID值,它是alldocs的id(相同的列表,网站,文件名),然后执行脚本,你的链接会被恢复,会在你的dispform.aspx页里重新生成默认控件,这次不要删除了,隐藏就行了,好了,大功告成。

 

通过以下sql语句,可以查询到你的相关列表信息

declare @ListName nvarchar(100)

declare @UserName nvarchar(100)

-- TYPE YOUR INPUTS HERE

set @ListName = 'newse'  Your list's name

set @UserName = 'bill' -- Your SharePoint admin user's username 98F0AA9B-67D2-47A1-91C8-F94F4825F82D

set @ListName = '%' + @ListName + '%'

set @UserName = '%' + @UserName + '%'

declare @ListId uniqueidentifier

declare @UserID int

declare @SideId uniqueidentifier

select @ListId = tp_ID from AllLists where tp_Title like @ListName

select @UserID = tp_ID from UserInfo where tp_Login like @UserName

select @SideId = tp_SiteID from UserInfo where tp_Login like @UserName

exec proc_GetListWebParts @ListId, @UserID, 0, 0, 0, @SideId  -- 通过这里会显示你的列表视图的记录,通常有四个


select * from webparts where tp_listid = @listid

select * from alldocs where listid = @listid

 

INSERT INTO [WebParts]
           ([tp_SiteId]
           ,[tp_ID]
           ,[tp_ListId]
           ,[tp_Type]
           ,[tp_Flags]
           ,[tp_BaseViewID]
           ,[tp_DisplayName]
           ,[tp_Version]
           ,[tp_PageUrlID]
           ,[tp_PartOrder]
           ,[tp_ZoneID]
           ,[tp_IsIncluded]
           ,[tp_FrameState]
           ,[tp_View]
           ,[tp_WebPartTypeId]
           ,[tp_AllUsersProperties]
           ,[tp_PerUserProperties]
           ,[tp_Cache]
           ,[tp_UserID]
           ,[tp_Source]
           ,[tp_CreationTime]
           ,[tp_Size]       )
     VALUES
           ('D671436D-56B6-482B-943E-DA149D74EB5F'
           ,'43C8B902-D2EB-4419-9CA8-096278450E25'
           ,'445D5FAF-9782-46B6-8518-DFF30565A539'
           ,4
           ,1048576
           ,NULL
           ,''
           ,1
           ,'044C898F-6835-48A8-93CD-23B0B9B63DB6'
           ,1
           ,'Main'
           ,1
           ,0
           ,NULL
           ,'293E8D0E-486F-E21E-40E3-75BFB77202DE'
           ,NULL
           ,NULL
           ,NULL
           ,NULL
           ,NULL          
           ,'1900-01-01 00:00:00.0'
           ,116
            )

posted on 2008-09-10 02:10  bill chen  阅读(586)  评论(1编辑  收藏  举报