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’ve been trying to use ListData.svc to get a REST feed from a list (actually a pages library) using something like:

http://SharePoint/_vti_bin/ListData.svc/Pages?$orderby=NewsArticleDate&$filter=(2010 eq year(NewsArticleDate)) and (06 eq month(NewsArticleDate)) and (ContentType eq 'News Article')

It all works great and our front-end developers have been able to combine this feed with JQuery and put together a good looking display with asynchronous filtering to dynamically update the REST url and resend. Our problem comes when trying to use this with anonymous mode…

By turning on anonymous access (anonymous users can browse to the list items) this feed simply returns an error:

Object reference not set to an instance of an object.

Is it just not possible to use this service in anonymous mode?

share|improve this question
add comment

8 Answers 8

I recognise I posted this question a while ago now, but having just seen Jim's answer it reminded me of something I'd seen a couple of months ago...

In the August Cumulative Update for SharePoint 2010 Foundation one of the areas it mentions a fix for is:

Anonymous users cannot use Language Integrated Query (LINQ) to query data in Microsoft SharePoint Foundation 2010. Additionally, the anonymous users are prompted for user credentials when they use LINQ to query data.

I remember discussing this at the time with a colleague and we believed that by fixing this underlying LINQ issue, the REST anonymous access should also now be ok. I haven't revisited this to confirm but I hope this helps.

share|improve this answer
add comment

What happens if you get rid of the filter?

It doesn't seem like a very user-friendly error, so I can't imagine this behaviour being by design :)

Do you get a proper ASP.NET error page with stracktrace etc?

share|improve this answer
    
Still the same without the filter. Just hitting /_vti_bin/ListData.svc gives the same error message. Turning on the errors in the web.config for both the anonymous web application and the vti_bin doesn't change the error message at all. –  GlynClough May 19 '10 at 10:52
    
Try it on an out of the box site collection to eliminate any potential errors caused by custom code (i.e. custom fields). You don't have any custom httpmodules, right? –  Jaap Vossers May 19 '10 at 16:49
add comment

I am able to recreate the error on a standard SharePoint 2010 Foundation RTM build, with the ADO.NET update for Server 2008 R2 (had to apply this before ListData.svc would load).

Looks like this isn't intended for anonymous access at all.

share|improve this answer
add comment

I got the same result as James: works with authenticated access only.

Alex, you are referring to the ListData Web service in SP2007 and SP2010: _vti_bin/DspSts.asmx. The OP is talking about the new REST service (SP2010 only): _vti_bin/listdata.svc

share|improve this answer
add comment

It could be that SPWebApplication.ClientCallableSettings.AnonymoutRestrictedTypes collection applies to REST the same way it applies to the ClientOM.

Try this (PowerShell):

$app = Get-SPWebApplication "http://your.anonymous.site"

$app.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")

$app.Update()

share|improve this answer
    
this did not help me with the same problem –  Matt Feb 21 '13 at 16:55
add comment

Could it be a simple permission issue? I appears that you need to grant Browse User Information permission to the anonymous account to allow it.

share|improve this answer
add comment

Accessing listdata.svc (REST) with anonymous authentication is not possible. You need credentials to get response from this web service otherwise you cannot use it.

share|improve this answer
add comment

If you need to access list data via REST anonymously, you can do it via the REST api for search. It has to be enabled, so be sure to check out the "enabling anonymous search REST queries" section here.

share|improve this answer
add comment

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.