Odata connection in LinqPad gives (403) Forbidden error

I have LinqPad 4 installed on my machine. I am trying to use LinqPad for generating a URL for Odata/Excel for MS Project server 2013. When I try to add a connection using the below URI in LinqPad using odata driver, it's giving me the below error. The error is the same with or without my login credentials. Any ideas?

URI -> https://companyname.sharepoint.com/sites/pwa/_api/ProjectData/

WebException: The remote server returned an error: (403) Forbidden


  • Sounds like it needs authentication. Have you entered username/password details into the box provided?
  • Yes, it gives me the same error in LinqPad with or without the authentication details.
    My login ([email protected]) and password work fine in excel 2013 with odata driver (Data->From Other Sources->From Odata data feed) for the link https://companyname.sharepoint.com/sites/pwa/_api/ProjectData/. I see all the tables in project server database with this.
  • When you specify a username and password in the OData properties dialog, LINQPad sets the credentials on the DataServiceContext instance as follows:

    dsContext.Credentials = new NetworkCredential (username, password);

    As far as I know, this is the correct way to do it. If you're aware of something else, please let me know.
  • Thanks Joe. With LINQPad, I am trying to authenticate to Office 365 tenant. I am not sure if I am missing any steps while trying to connect.
  • Someone else gave me a repro for what could be the same problem, which I've fixed in in 5.02.05.

    Try the new beta and let me know.
  • Hey, Joe, this isn't working for the latest POL/SharePoint Online. Look at the type SharePointOnlineCredentials and the ServerBuildingRequest event. Add the header like this: e.Headers.Add(@X-FORMS_BASED_AUTH_ACCEPTED, "f");

    I have a sample I can send you. I am new to LinqPad. If you accept submissions, I can write it for you and test it.


    Colby Africa
    (Former member of the Microsoft Project product group)
  • Have you tried clicking the 'Custom Headers' hyperlink in the connection properties and adding the header you describe?
  • Joe, where can we find this option?
    Have you tried clicking the 'Custom Headers' hyperlink in the connection properties and adding the header you describe?
  • Are you using the OData 3 driver (built-in) or the OData 4 driver (third-party)?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!