Saturday, 14 January 2012

REST Filter for Choice Column in Sharepoint List.svc

I just figured out how to filter against a sharepoint list choice type column. Myself being a beginner of sharepoint surfed web a lot to find how to filter for choice type column in a sharepoint list with no success. May be for experienced sharepoint developer this would be a piece of cake. But for me it took some 30 minutes of thinking. So I decided to post this for sharepoint beginners like me.

I have created a sharepoint list called "Customers" in my sample site called "contoso" and I tried to read the list as a feed using my browser. This list has four columns and Region and Size columns are Choice columns.

When I typed

http://spsrv/sites/Contoso/_vti_bin/ListData.svc/Customers


in my browser I got my customer list as a feed. Then I tried filtering for Name and it was easy and success.

http://spsrv/sites/Contoso/_vti_bin/ListData.svc/Customers?$filter=Name eq '
Fabrikam'

But when I tried to filter for Region column using

http://spsrv/sites/Contoso/_vti_bin/ListData.svc/Customers?$filter=Region eq 'East'
it did not give me the feed but gave "HTTP 400 The webpage cannot be found". I googled around but was not successful.

Then I thought a bit and and just opened the feed page viewsource. Aha! there I found the solution and what I was doing wrong. The choice columns had a suffix added as "Value". So my Region was RegionValue.


I then tried with following in my browser and successfully got the filter working against choice column.

http://spsrv/sites/Contoso/_vti_bin/ListData.svc/Customers?$filter=RegionValue eq 'East'

Friday, 6 January 2012

Application Pool Identity for WCF to Work with IIS 7

If you host your WCF services in IIS7 there is small trick you have to do to make it work. You have to change your application pool identity to Network Service.
You can do this by expanding your IIS Server --> Application Pools --> Right Click and Select the Application Pool Advance Settings


In the popup window click the Identity under Process Model

Change the Identity to Network service.

Give NetworkService access to the physical folder of the wcf site. and you are good to go.

Popular Posts