Wednesday 23 December 2015

Value does not fall within the expected range - SharePoint Client Object Model


While working on SharePoint 2013 client object model to upload files to servers i have received the following error:

Value does not fall within the expected range Sharepoint

UploadLayoutsPageBase: Microsoft.SharePoint.Client.ServerException: Value does not fall within the expected range.  
 at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)  
 at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()


Solution:

If you are using full file path , make sure not to add any extra slash

Valid :   http://10.151.0.67:8010/sites/docs_1/Contact/20/photo_v1.jpg
Invalid : http://10.151.0.67:8010//sites/docs_1/Contact/20/photo_v1.jpg


Some people saying that you have to give relative file URL not full path , for me i used to give full path and it's working very well.



Value does not fall within the expected range  is a common error just like sorry something went wrong , please try again later.