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

At the top level of my site collection, I have created a list called "Markets", and a site column called "Market", defined as a lookup to the Markets list.

In a subsite of this same site collection, I have a list called Projects, where I have included the Market site column.

I am now trying to retrieve the Title and Market information from the Projects list using REST services. The following triggers an error:

http://site/subsite/_vti_bin/listdata.svc/Projects?$expand=Market

What am I missing?

[Edit] Clarification: the point is that the above notation works perfectly when the lookup list is in the same site as the Projects list. My issue is only related to site columns, where the source list for the lookup is at the top level.

share|improve this question
    
Two questions: 1. What authentification type do you have for your web application? 2. Can you provide the exception message and stack trace? –  Andrey Markeev Jan 9 '12 at 21:01
    
I am in a hosted environment and I don't know. I have edited my question to clarify it, I don't think it is related to authentication as everything works fine when the lookup is in the same subsite. The error message in the browser is: "the webpage cannot be found". –  Christophe Jan 9 '12 at 21:27
    
Using REST can you access the lookup list itself in the top site? I wonder if it's an authentication issue with accessing the list in the context of that top site. –  Andy Burns Jan 10 '12 at 14:29
    
I can access it. Of course the path is slightly different: site/_vti_bin/listdata.svc/Markets –  Christophe Jan 10 '12 at 17:42
    
Same problem here: - list and lookup column (multiple values) in the root site. - list in the sub-site using column from root site. But when i query the sub-site list, the root lookup column does not show. Single value lookups show only as IDs... 'fieldname'Id. In my opinion its a BUG on the product.. Anyone knows a solution? –  user13563 Dec 11 '12 at 19:05
add comment

1 Answer

up vote 0 down vote accepted

I'm not sure exactly what you're trying to do, but you can't expand a parent site's list from a sub-site via the REST interface. The way that SharePoint goes about getting the additional data via the REST service assumes that the list exists in the same context, not a parent site. This means that, although the fields look identical in the initial XML, the REST service isn't going to pull the correct list on expansion because it has no data about it other than what you give it. That's why it looks in the same context and errors out. It's trying to call http://site/subsite/_vti_bin/ListData.svc/Market(#ID) to get that data, but there is no Market list in the subsite, thus the 400 error.

I suggest using the Client Object Model to attempt to achieve this instead. Although it's not as nice as ListData.svc, you won't face this issue.

I will write a blog soon to explain this issue further.

share|improve this answer
    
I am just doing the regular stuff, storing metadata at the top level, consuming it across the site collection, and then doing some aggregation with REST. Looking forward to your blog post! –  Christophe Jan 10 '12 at 21:52
    
Did you write that blog post? Also, do you happen to know if the new REST api in SP 2013 has the same issue? –  Christophe Dec 11 '12 at 19:08
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.