Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
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 Apr 2 '12 at 6:36
    
this exception does not give any helpful information that I can use to help you ( –  Alexander Apr 2 '12 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 Apr 2 '12 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 Apr 2 '12 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 Apr 2 '12 at 13:37
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.