Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Reading File properties from the Document Library

Status
Not open for further replies.

john121

Programmer
Oct 18, 2007
9
GB
Hi all

I am trying to retrieve the properties of the Files (Name, Created By and Last Modified By) from document library before migrating the documents from SP2003 to MOSS 2007

but the system hangs at the line temFile.Author.Email

here is what i am doing

Code:
SPSite site = new SPSite(sharePointURL); 

SPWeb web = site.OpenWeb(); 

web.AllowUnsafeUpdates=true;

string strContentType=""; 


// docLib is the name of document library
SPFolder folder = web.GetFolder("docLib");

SPFileCollection files=folder.Files;


//"docLib" is name of document library and testFile.doc is the name of file
string url=sharePointURL+"/"+"docLib"+"/"+"testFile.doc"

SPFile tempFile = web.GetFile(url);



[COLOR=#ff0000]tempFile.Name (//THis works perfect)

temFile.Author.Email( //System Hangs)

temFile.ModifiedBy.Email (System Hangs)[/color]

don't know why this doesn't work.

I have done a bit of a research into it and come to a conclusion that, the system is hanging because we have around 100000 documents in that library.


but why SP2003 is trying to load the entire document library, when we asked for it to get the file properties by giving the absolute URL of the filen directly.

any help will be really really apreciated, as i was struggling to find another alternative to fix this problem.

Many Thanks

 
Typo?

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Pity the insomniac dyslexic agnostic. He stays up all night, wondering if there really is a dog.
 
Hi Phil

My aplogies for that typo. Infact that was the mistake of my manual typing here rather cut and paste.

but my actual problem is, i have a large document Library list(500000 files) from which i am trying to migrate to 2007.

I think the reason it is failing to read those file properties is because of the number of files in that document library folder.

Please let me know if there is any other best possible solution to this

Many Thanks


 
Does the code work against a smaller library? I'm asking because I suspect that you may have to handle the sub-properties like tempfile.author.email a bit differently.
 
Hi Phil

Sorry for the delay in responding to your reply.

It does work with smaller libraries.

 
Yeah, it's probably doc library size. I'm dealing with the same issue here.
 
interestingly i was able to get the File names, even if it is a large libray.

how are you approaching this issue. I haven't got a clue what else we should do.

here is i am trying right now..

Created another library in the same site and uploaded some files in to it and start migration with small number of files. But the problem is when i upload to new library using files.add, it is changing the document properties(Modified dates etc). But i want to retain them as it is previously were there.

I stucked up with that
 
I'm not doing any programming against it yet. Our issue is that it times out in the WebDAV interface and takes ages to render in the portal.

I'm going to subdivide the library by functional areas so we don't have a big pile of files to begin with. This should ease our display issue, but I'm not sure if this applies to your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top