Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top