This is the first time I write code for document library and need some help. My goal is to check each item’s version and move the items with version higher to 2 to a subfolder. I believe it should be much easier use the server object mode. Since I need to run the code in a remote pc, so I have to use client object mode. I cannot find any method of property associate with version in client mode. Here is the code I have. I will appreciate if someone can help me out. Many thanks.
ctx = newClientContext("http://localhost/");
web = ctx.Web;
list = web.Lists.GetByTitle("Test Docs");
ctx.Load(list);
ctx.ExecuteQuery();
CamlQuery qry =newCamlQuery();
qry.ViewXml = "<View />";
ListItemCollection items = list.GetItems(qry);
ctx.Load(items);
ctx.ExecuteQuery();
foreach (ListItem itemin items)
{
//get the item version
//if version > 2 then move the item to a subfolder called “New Files”
}