I've just started to look at using spmetal with SP 2010 to read data from document libraries:


I'm curious as to how I can ensure that I only retrieve files from a sharepoint document library that have been published, there doesn't seem to be any facility in the code that spmetal generates to be specific about the data that it returns.

Would be interested to here if anyone has managed to achieve this.

all the best


I could be very wrong but from what I understand, SPMetal only generates code which replicates the structure of a list in the form of strongly typed objects - the generated code has no relevance on the contents of a list. (Please inform if incorrect).

To only retrieve published documents you need to read up on LINQ to SharePoint, to find out how to filter a query by specific columns and data, in your case find out what column is used to store whether a document is published and use that in your LINQ query.

| improve this answer | |
  • We ended up referring to the enumeration for spfilelevel as a way to determine the currently published state of a given file. Hope this is of use. msdn.microsoft.com/en-us/library/… – Anonymous Aug 27 '10 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy