While using Client Object Model to access a list item I jumped into a strange error :) I should Say ! I went like "Cannot complete this action. Please try again" I reviewed the whole code and was blank at the end... I Googled whole day and found no option other than Thread.Sleep(toUnlimitedTime) as I tested :) At the end desperately I reviewed my CamlQuery and there it goes!!! I missed adding </Query> ending tag in the query. And the error was gone :) Hard work Huh!!
Web web = ctx.Web;
ctx.Load(
web,
website => website.Title,
website => website.HasUniqueRoleAssignments);
ctx.ExecuteQuery();
List list = ctx.Web.Lists.GetByTitle("MyList");
CamlQuery query = new CamlQuery();
string que = @"<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>xyz</Value></Eq></Where></Query></View>";
query.ViewXml = que;
SP.ListItemCollection coll = list.GetItems(query);
ctx.Load(coll, items => items.Include(item => item,
item => item.Id,
item => item.HasUniqueRoleAssignments,
item => item.DisplayName));
ctx.ExecuteQuery();
Faced the same issue .. was missing / in Tag
ReplyDelete