3
votes

I have an extrnet site that has a shared document file. I can upload files just fine, view them, etc... But when I try to check one out to make changes, I immetiately get this:

Value does not fall within the expected range. at Microsoft.SharePoint.SPWeb.GetWebRelativeUrlFromUrl(String strUrl, Boolean includeQueryString, Boolean canonicalizeUrl) at Microsoft.SharePoint.SPWeb.GetWebRelativeUrlFromUrl(String strUrl) at Microsoft.SharePoint.SPWeb.GetFile(String strUrl) at Microsoft.SharePoint.ApplicationPages.Checkin.get_File() at Microsoft.SharePoint.ApplicationPages.Checkin.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

And this is logged on as the administrator. Any ideas would be greately appreciated.

2

2 Answers

0
votes

I have previously received this error when trying to access a system running on a 64 bit OS when the code is 32bit OR the custom .NET code is running on a version of .NET higher than 3.5.

I am not completely sure which, otherwise it is just as the error says and that the url being passed into the GetWebRelativeUrlFromUrl does not match any SPSites in the farm.

0
votes

it was occurred for me on Web.GetFile method. and it was resolved after finding that this function only works if the file is in the current site and not the root site in my case. after copying the file in the site assets of working site and changing the file path it works

using (Stream tplStream =   
SPContext.Current.Web.GetFile("/sitename/SiteAssets/file.docx").OpenBinaryStream())