With both of these commands, when I try to add an Accept header (I want to receive my CRM 2011 data in JSON format, so I need Accept=application/json) I receive the error:
“This header must be modified using the appropriate property or method.”
I think this is a bug. This link shows the bug, and I agree that the workaround does not apply
Hello, I’ve just hit this same issue but your other post seems to mention you are able to get something back from listdata.svc.
I don’t seem to be able to get anything back at all. Did you discover a clever trick or misconfiguration?
Not sure what other post you are referring to. This one? If so, I did not need to specify an Accept header. I only needed an Accept header when working with CRM 2011. Does that answer your question?
Yes, that is the post I was referring to, sorry to be vague. I must have a different issue. When I am hitting SharePoint’s listdata.svc with either Invoke- I get a 400 error, even though I have triple checked my URL using the browser. Watching it with Fiddler I see that it’s a pretty sparse set of request headers, so I thought an Accept might do the trick.
If I figure out why, I will post back here.
So, when really looking at Fiddler, noticed there were no authentication headers. Turns out that having anonymous turned on at the web application level (central admin) gives certain clients fits. I’m only using anonymous in one site collection, but it seems the top level setting gets IIS working differently despite how it looks from the SharePoint side.
I turned off anonymous and then I had no issues with 400 errors from the Powershell Invoke-RestMethod.
I would never have gotten that one! I never allow anonymous, so it is not something I would ever have thought of. Thanks for updating.