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 have a list of 6000 listitem GUIDs. I need to check if each item still exist on the Web.

Previously, I was using the SPWeb.GetFile(GUID) method to check the item.

But now I need to convert that process usinig the ClientObjectModel. I cannot find a way to retrieve the item using the GUID.

I even tried from the "List" object. And can't find a way to retrieve the item from its GUID neither.

Please help! :(

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I'm afraid the only way is to use CAML query. Even worse, since you don't have a SPSiteDataQuery alternative in Client Object Model, you can't perform cross-site queries, so you have to query each list separately.

Example code for quering a list with SharePoint 2010 Client Object Model:

string siteUrl = "http://MyServer/sites/MySiteCollection";
string listTitle = "your list title here";
string guid = "put-your-guid-here";

ClientContext clientContext = new ClientContext(siteUrl);
Web site = clientContext.Web;
List targetList = site.Lists.GetByTitle(listTitle);

CamlQuery query = new CamlQuery();
query.ViewXml = String.Format("<View><Query><Where><Eq><FieldRef Name='UniqueId'/><Value Type='Guid'>{0}</Value></Contains></Where></Query></View>", guid);
ListItemCollection collListItem = targetList.GetItems(query);


bool itemIsFound = (collListItem.Count == 1);

(the code has been tested and works)

share|improve this answer
Woahhh that's nasty :P. It will take forever to go through my 6000 items. Anyways since I don't have the choice, I will do it that way! :) thanks –  danbord Feb 3 '12 at 18:29
@danbord, probably you should consider creating a custom web service which leverages the SPWeb.GetFile method - of course if you have a possibility (i.e. permissions) of doing this. I think this will work much faster. –  Andrey Markeev Feb 3 '12 at 18:32
Good suggestion! Thanks. –  danbord Feb 3 '12 at 18:50

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.