Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

http://msdn.microsoft.com/en-us/library/ee538255.aspx

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

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.