0

I'm developing a web part which is needed in WSS 3.0 showing some SilverLight graphics based on the view and its filtering. The view is chosen from the a web editor part and the needed web part properties are passed into SilverLight as params.

Inside the SilverLight App.xaml.cs I'm making a param array with all the web part properties.

App.strArgumentArray[1] holds the listname, App.strArgumentArray[8] holds the viewname, App.strArgumentArray[17] holds the webID and App.strArgumentArray[16] holds the views SchemaXml:

    //From inside the web part. The strListViewQueryXML is passed as a param to SL
    SPList oList = oWeb.Lists[SomeListName];
    SPView oListView = oList.Views[SomeListNameView];
    string strListViewQueryXML = oList.Views[oListView.Title].SchemaXml;         

Inside the MainPage.xaml.cs the SchemaXml is split up in XElements to be used in the GetListItemsAsync method.

            string query = App.strArgumentArray[16]; //Holds the SchemaXml

            using (StringReader sr = new StringReader(query))
            {
                using (XmlReader xtr = XmlReader.Create(sr))
                {
                    queryX = XElement.Load(xtr); 
                }
            }

            queryElement = queryX.Descendants("Query").First();
            viewElement = queryX.Descendants("ViewFields").First();
            optionElement = XElement.Parse(@"<QueryOptions/>"); //Empty QueryOption

            ListsSoapClient objLSC = new ListWebServices.ListsSoapClient("ListsSoap", App.serviceUri);
            objLSC.GetListItemsCompleted += new EventHandler<GetListItemsCompletedEventArgs>(objLSC_GetListItemsCompleted);                                                                    
            objLSC.GetListItemsAsync(App.strArgumentArray[1], App.strArgumentArray[8], queryElement, viewElement, null, optionElement, App.strArgumentArray[17]);

I feel like I've tried everything. The GetListItemAsync method works fine if I use it with only the first argument (string listName) but when I use the rest of the arguments in GetListItemAsync

    GetListItemAsync(string listName, string viewName, XElement query, XElement viewFields, string rowLimit, XElement queryOptions, string webID);

it keeps throwing a "System.ServiceModel.CommunicationException: The remote server returned an error: NotFound." The App.serviceUri has not changed so why this error? What am I doing wrong here?

Kind regards Michael Lau Wolfsberg

4
  • Can you try to configure SharePoint WCF service to return the real error message like explained here (benday.com/2010/08/16/…)? It may help to resolve your real problem.
    – Alex Boev
    Commented Feb 21, 2012 at 10:56
  • I've used the tool Microsoft Service Configuration Editor from the Microsoft Windows SDK to modify the includeExceptionDetailInFaults property of <serviceDebug> in the List.asmx service that I've added to my project. Still gives me same error. Am I doing something wrong?
    – Wolfsberg
    Commented Mar 1, 2012 at 9:41
  • Here (stackoverflow.com/questions/814627/…) there's an advice to use a http traffic inspection tool like Fiddler to view the real message. Can you try it?
    – Alex Boev
    Commented Mar 1, 2012 at 13:31
  • @Wolfsberg - How did you end up finding the error?
    – xr280xr
    Commented Sep 4, 2013 at 19:30

1 Answer 1

0

Okay I found the error. GetListItemAsync takes both string viewName and XElement query as arguments:

     GetListItemAsync(string listName, string viewName, XElement query, XElement viewFields, string rowLimit, XElement queryOptions, string webID);

If you intent to use a specific query then don't also specify the viewName. The view name has to be set to null like this :)

    objLSC.GetListItemsAsync(App.strArgumentArray[1], null, queryElement, viewElement, null, optionElement, App.strArgumentArray[17]);      

I will still try use the http traffic inspection tool since this would help me in future debugging situations :) Thanks alot for your answers Alex.

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.