Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Retrieving the last published version using CAML

  Asked By: Hiral    Date: Jun 16    Category: Sharepoint    Views: 5392

I am using a CAML query to retrieve a list of articles in a Pages library in SharePoint publishing web site. I need to retrieve all the published articles. If I use a query like


<Eq><FieldRef Name='_ModerationStatus' /><Value Type='ModStat'>Approved</Value></Eq>

then I will only get the currently published articles. But if there is a previously published version, I need to retrieve the previously published version of the article.
For example, if an article is published(then it is retrieved and is displayed) and the editor will edit the article for a minor modification, then if I put the above query, then the article is not retrived at all(and goes out from the display).
If I dont put the above query then even the draft versions are retrieved(and displayed)

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Lindy England     Answered On: Jun 16

For your scenario, you can use the SPListItem.Versions to get all of the versions
For more information, please refer to:
msdn.microsoft.com/.../...emversioncollection.aspx
www.sharepointkings.com/.../...rsions-in-list.html

 
Didn't find what you were looking for? Find more on Retrieving the last published version using CAML Or get search suggestion and latest updates.




Tagged: