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