7

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?

2

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.

  • I installed update, restarted the server, ran the configuration wizard but still "object reference" error. – Ali May 20 '15 at 4:45
1

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?

  • 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. – Glyn 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
1

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.

0

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

0

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()

  • this did not help me with the same problem – Matt Feb 21 '13 at 16:55
0

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.

0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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