2

We have a custom web service hosed in the ISAPI\ folder. We are getting the SPSite of a different site collection in the same Web Application using the url (and making sure it is exposed after use). To Query lists content on that site collection we use the CrossListQueryCache.GetSiteData(SPSite, webUrl) overload. I have tried using list id and name but no difference. I have also tried to make a singleton, making sure we are using the same SPSite object through the lifetime of the process (thinking the error has to do with a "different" SPSite object).

The issue is that sometimes (often if there are rapid calls) I get a "Cannot use the changeToken from one object against a different object" exception in the GetSiteData call. I only see that I get the exception in debug mode, I think the exception is caught in the GetSiteData method and not logged in the ULS.

What is the reason for this exception, and how can I handle/Fix it? Or is this something that is handled by the SharePoint API?

 internal DataTable GetSiteCollectionQueryResult(SPSite site, string query, string listName, string viewFields, uint rowLimit)
    {
        var crossListQuery = new CrossListQueryInfo
        {
            UseCache = true,
            Webs = @"<Webs Scope='SiteCollection' />",
            RowLimit = rowLimit,
            Query = query,
            ViewFields = viewFields,
            Lists = string.Format(@"<Lists Title='{0}' />", listName)
        };

        var crossListQueryCache = new CrossListQueryCache(crossListQuery);
        var tbl = crossListQueryCache.GetSiteData(site, site.RootWeb.Url);
        return tbl;
    }
1
  • After using reflection and trying to find the connection between SPChangeCollection.ValidateChangeToken and GetSiteData. I found that in CacheManager.CheckForChanges(SPSite) method has a cache that is setting a flag. I will give it a day then post this as the answer.
    – gaotter
    Commented Dec 2, 2013 at 16:14

1 Answer 1

0

I found using reflection that the exception was handled internally in the in the CacheManager.CheckForChages(SPSite) method, and the it was handled and is setting a flag of some sort.

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.