vendredi 26 décembre 2014

The length of the URL for this request exceeds the configured maxUrlLength value. REST API



I was wondering if someone could help, or am I missing something. In the articles found here http://ift.tt/13IyE86


They refer to using the /getfilebyserverrelativeurl. When I build my request and try and make a HttpWebRequest I get



The length of the URL for this request exceeds the configured maxUrlLength value



in the webresponse.


I'm making these requests from a console application against Office 365/SharePoint Online.


The url length is is 305 in this test case.


This is the code I am using



HttpWebRequest request = HttpWebRequest.Create(resourceUrl) as HttpWebRequest;
request.Credentials = _credentials;
request.CookieContainer = _cookieContainter;
request.Headers.Add("X-RequestDigest", _formDigest);
request.Method = "POST";
request.Timeout = 3600000;
request.Accept = "application/json; odata=verbose";
request.ContentLength = incomingStream.Length;
request.AllowWriteStreamBuffering = false;
request.KeepAlive = false;

using (var reqStream = request.GetRequestStream()) {
incomingStream.CopyTo(reqStream);
}

WebResponse response = request.GetResponse();
using (System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream())) {
result = sr.ReadToEnd();
}


When its caught by the WebException and I read the exception response all I get is this "The length of the URL for this request exceeds the configured maxUrlLength value."


This is the resourceUrl:



http://ift.tt/13J0vVa('/personal/user_account_tenant_onmicrosoft_com/Documents/Test/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso.001')/startupload(uploadId=guid'38acfb37-ccd5-4ac1-961d-090ce1ed9d6f')









0 commentaires:

Enregistrer un commentaire