I am facing error while invoking Lists.asmx
Server was unable to process request. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
It was running in production previously but suddenly it stop working and giving me access denied error
I check all permissions and fedauth is working properly.
string authCookie = onlineCredentials.GetAuthenticationCookie(siteUri);
CookieContainer GetCookieContainer = new CookieContainer();
string trimmedCookie = authCookie.TrimStart("SPOIDCRL=".ToCharArray());
GetCookieContainer.Add(new Cookie("FedAuth", trimmedCookie, string.Empty, siteUri.Authority));
code example is attached.
spWebLists.Lists listService = new spWebLists.Lists();
listService.CookieContainer = cookieContainer;
listService.Url = url + "/_vti_bin/Lists.asmx";
listName = "Custom1";
// Instantiate an XmlDocument object
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
System.Xml.XmlNode node1 = listService.GetList(listName);