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! :(

2 Answers 2


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)

  • 1
    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, 2012 at 18:29
  • 1
    @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. Feb 3, 2012 at 18:32

As Andrey pointed out there is no SPList.GetItemByUniqueId Method alternative in CSOM API.

You could utilize the following extension method to load the list item by GUID in CSOM:

static class ListExtensions
    /// <summary>
    /// Load List Item by Guid 
    /// </summary>
    /// <param name="list"></param>
    /// <param name="itemGuid"></param>
    /// <returns></returns>
    public static ListItem LoadItemByUniqueId(this List list, Guid itemGuid)
        var context = list.Context;
        var query = new CamlQuery
            ViewXml = String.Format("<View><RowLimit>1</RowLimit><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Guid'>{0}</Value></Eq></Where></Query></View>", itemGuid),
        var items = list.GetItems(query);
        return items.Count > 0 ? items[0] : null;

Key points:

  • RowLimit property is specified in query to improve performance
  • 1
    Please fix the ViewXml in the extension method: - fieldname: "GUID" - closing tag for <Eq> --> </Eq> instead of </Contains> final ViewXml will be: 'ViewXml = String.Format("<View><RowLimit>1</RowLimit><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Guid'>{0}</Value></Eq></Where></Query></View>", itemGuid)' Aug 27, 2014 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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