Reputation: 1
I need to extract documents including previous versions(*.0) of them from a SharePoint database.
The file I get from the csv dump is not even half of the size of the file I get from the SharePoint gui and I've compared the blobs from these two and they are identical to the point where the blob from the gui file continues and the blob from the database stops. I've also opened the .docx file as a .zip and seen that there are folders and files missing.
Everything I've seen online says to get the blob from AllDocStreams.Content and that is that. But SharePoint must be getting the rest of the blob from somewhere else, and it's not in AllFileFragments, I've checked.
Upvotes: 0
Views: 100
Reputation: 1257
I have a script that might help you, but it was in version 2013, I don’t remember all the options, but try to figure it out yourself, this is an example for you.
Declare @ID uniqueidentifier
--select top 1 @ID = id from alldocs where LeafName like N'text.xls%' --and DirName like N'sites/test/test1/'
SET @ID= '5FD687B8-FDC1-461B-9345-7229FA60D13A'
--select @ID
--set @ID='1202436F-BD82-4694-997C-62791374C288'
--select max(BSN) from DocStreams where DocId='1202436F-BD82-4694-997C-62791374C288'
--select NextBSN from alldocs where id = '1202436F-BD82-4694-997C-62791374C288'
--update alldocs set NextBSN= 17865 where id = '1202436F-BD82-4694-997C-62791374C288'
select id as DocId, IsCurrentVersion, Level,NextBSN, TimeLastModified, TimeLastWritten, DirName, LeafName,* from AllDocs where Id= @ID
select * from DocsToStreams where DocId= @ID and HistVersion=0 and level=1
--select * from DocsToStreams_ORIGINAL where DocId= @ID and HistVersion=0 and level=2
select * from DocStreams where DocId = @ID
select sum(Size),count(*) from DocsToStreams dts join DocStreams ds on dts.DocId = ds.DocId and dts.BSN=ds.BSN where ds.DocId = @ID and HistVersion=0 and level=2 --order by dts.streamid
select max(BSN) from DocStreams where DocId=@ID
--select * from DocStreams where DocId = @ID
select * from DocsToStreams where DocId= 'A919A064-A5B9-4D83-95FE-5497F4D711F3'
select count(*) from [dbo].[DocsToStreams]
--INSERT INTO [dbo].[DocsToStreams]
([SiteId]
,[DocId]
,[HistVersion]
,[Level]
,[Partition]
,[BSN]
,[StreamId])
select SiteId, DocId,0,2,0,BSN,CASE WHEN BSN = 17857 THEN 1 ELSE BSN - 40 END from DocStreams where DocId = '1202436F-BD82-4694-997C-62791374C288' and BSN >= 17857
Upvotes: 0