1

I created custom wcf that retrieve items from the list. Is it possible to use spquery within the wcf to filter the list items

1 Answer 1

2

If your WCF is located under '_layouts' folder and configured correctly you have access to the SharePoint object model as in web parts, application pages, etc. So you can use list.GetItems(spQuery) method to filter items.

You can read more about WCF services and SharePoint here. How to configure your service you can find in this post.

9
  • I can access client objects but when i test with wcftestclient exception shows Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.
    – yogesh
    Commented Apr 2, 2012 at 6:36
  • this exception does not give any helpful information that I can use to help you (
    – Alexander
    Commented Apr 2, 2012 at 11:28
  • Thanks i overcome this exception(I didn't end <Eq> taq).Now another exception <nativehr>0x80070057</nativehr> .I used multi value lookup for joining two lists.pls help
    – yogesh
    Commented Apr 2, 2012 at 13:03
  • This info lesser than you provided before. Could you provide a code that trows exception. Also you can try to test your query in U2U Caml Builder tool.
    – Alexander
    Commented Apr 2, 2012 at 13:08
  • SPQuery listQueries = new SPQuery();listQueries.Query = "<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>" + username + "</Value></Eq></Where>";listQueries.Joins = "<Join Type='Left' ListAlias='countryListAlias'><Eq><FieldRef Name='Country' RefType='ID'/><FieldRef List='countryListAlias' Name='ID'/></Eq></Join>";listQueries.ProjectedFields = "<Field Name='Code' List='countryListAlias' Type='Lookup' ShowField='Code'/>";listQueries.ViewFields = "<FieldRef List='countryListAlias' Name='Code' />";listQueries .ViewFieldsOnly = true;
    – yogesh
    Commented Apr 2, 2012 at 13:37

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.