locked
Odata call in .Net application giving 401 Unauthorized error for Project Online RRS feed

  • Question

  • Hi

    We have been using Odata call for Project Online in our various .Net applications from past one year and today we found that it has stopped working in all and giving "The remote server returned an error: (401) Unauthorized" error.

    The code snippet we are using is 

    var cred = new SharePointOnlineCredentials(username,securepassword);

                        string url = odataurl
                        var req = (HttpWebRequest)WebRequest.Create(url);

                        req.Credentials = cred;
                        req.Headers["X-FORMS_BASED_AUTH_ACCEPTED"] = "f";
                        var resp = (HttpWebResponse)req.GetResponse();
                        var receiveStream = resp.GetResponseStream();
                        var readStream = new StreamReader(receiveStream, Encoding.UTF8);
                        string data = readStream.ReadToEnd();

    The error is occurring at line var resp = (HttpWebResponse)req.GetResponse(); as shown in screenshot .     Can you please let us know are there any security updates being performed for Project Online which needs update for development purpose. 
    Please help us in overcoming the issue as various production environments are getting affected.   

    getting error at highlighted

    Thanks  in advance.

                                                                                                            
    Tuesday, May 8, 2018 1:04 PM

Answers

All replies