locked
Exception "There is No web named..." with CrossListQueryCache.GetSiteData(...) RRS feed

  • Question

  • Hello Everybody,

    Back again with another issue...

    I am using a CrossListQueryCache for querying a custom list within another site collection. The problem I am facing is for the very first time (after deployment or an IISRESET) the method GetSiteData(...) is throwing an exception “There is No web named <source site col url>”. It happens just one time, afterwards it works fine.

    Here is the code I am using:

    DataTable itemTable;
    CrossListQueryInfo queryInfo = new CrossListQueryInfo();
    queryInfo.Query = query;
    queryInfo.ViewFields = "<FieldRef Name=\"Title\" /><FieldRef Name=\"Purpose\" /><FieldRef Name=\"ID\" />";
    queryInfo.Lists = string.Format("<Lists/><List ID=\"{0}\"/></Lists>", listID);
    queryInfo.Webs = "<Webs Scope=\"SiteCollection\" />";
    queryInfo.UseCache = true;
    queryInfo.WebUrl = "/sites/sourcesite";
    CrossListQueryCache queryCache = new CrossListQueryCache(queryInfo);
    using (SPSite site = new SPSite("http://myserver/sites/sourcesite"))
    {
     itemTable = queryCache.GetSiteData(site);
    }
    
    

     Please help.

    Thanks in advance

     

     


    Arun D Gangadharan
    Thursday, November 4, 2010 2:05 AM

Answers

  • Arun,

    where are you trying to execute this code from?

    - If its a console application and you are running VS2010 then check the target framework and make sure its either 3.5, 3 or 2.0 (as SharePoint is a 2.0).

    - Verify that the site exists first ( by using SPSite.Exists(SPSite) )

    - Try to open the web and running the query on it instead of the site.

     

    If that doesn't help, then give me more details and I'll try to reproduce the issue

    Friday, November 5, 2010 9:03 PM

All replies

  • Arun,

    where are you trying to execute this code from?

    - If its a console application and you are running VS2010 then check the target framework and make sure its either 3.5, 3 or 2.0 (as SharePoint is a 2.0).

    - Verify that the site exists first ( by using SPSite.Exists(SPSite) )

    - Try to open the web and running the query on it instead of the site.

     

    If that doesn't help, then give me more details and I'll try to reproduce the issue

    Friday, November 5, 2010 9:03 PM
  • Hi Dennis,

    Thank you for your valuable inputs.

    I had experienced this issue in my development environment. But when I moved it to another environment, there the issue was not  there. But as you commented, I have included the SPSite.Exists() check. Since I am expecting the cached results, I cannot use SPWeb object with GetSiteData() method.

    Thank you

    Arun


    Arun D Gangadharan

     

    Moderator Note: Mark the post from someone else that gave you the clues you needed - not your post.

    • Marked as answer by Arun D Gangadharan Monday, November 8, 2010 6:36 AM
    • Unmarked as answer by Mike Walsh FIN Monday, November 8, 2010 10:39 AM
    • Edited by Mike Walsh FIN Monday, November 8, 2010 10:42 AM Moderator Note added (to explain the unmark as answer + marking the earlier reply as an answer)
    Monday, November 8, 2010 6:36 AM
  • Arun,

    where are you trying to execute this code from?

    - If its a console application and you are running VS2010 then check the target framework and make sure its either 3.5, 3 or 2.0 (as SharePoint is a 2.0).

    - Verify that the site exists first ( by using SPSite.Exists(SPSite) )

    - Try to open the web and running the query on it instead of the site.

     

    If that doesn't help, then give me more details and I'll try to reproduce the issue

    1. I am not using console app. Its basically within navigation provider.
    2. I tried using SPSite.Exists() but still I am getting same error.
    3. I cannot use SPWeb since I need the caching functionality. Overload with SPWeb object doesn't support cached item retrieval.

    Despite of the issue, I tried to deploy this into another environment but there this particular issue was not appeared. This looks like a problem with my development environment.


    Arun D Gangadharan
    Monday, November 8, 2010 12:37 PM