SharePoint Evil #1: The URL ‘[url]’ is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web

I’m compiling a list of evil SharePoint errors: those errors that are so ambiguous and misleading that Google will shows 50 hits, with 10 different suggested solutions, and none of them work for your particular case.

Here is #1:

The URL ‘[url]’ is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web. at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)

I got this error when uploading documents to a document library. This error started to appear after I redeployed features to do with site columns and content types.

In my case the problem was a bad lookup site column definition that I deployed. This column was being included in 1 of the content types of the library, and hence becomes a column on the library, and hence caused the problem.

My site column (field) XML def looks like this:

<Field Type="Lookup" List="{8e980a24-9619-4969-9357-1eee9a1805c6}" ShowField="Title" DisplayName="Document Status" Required="FALSE" Group="All Documents" Description="Select the Archive option if this document is no longer Current and requires Archiving" ID="{cd94be8c-d754-4a6d-865d-7cb40375b11c}" SourceID="{36c01185-5d4b-4235-8f8b-59227bef7801}" StaticName="DocumentStatus" Name="DocumentStatus" WebId="{83255f8a-4772-4767-a261-376742747972}" Version="2">
	<Default>Current</Default>
</Field>

Notice the Default element. Because this is a lookup column, the Default value must have the format [id];#[value]. Changing the Default element to <Default>2;#Current</Default> fixes everything.

From my experience bad lookup column can lead to evil SharePoint errors. If you get desperate and nothing seems to work, I suggest remove all lookup columns from your content types and lists to isolate the problem.

Note: You can also get this error for completely different reasons. I have described the 2nd scenario here: https://bernado-nguyen-hoan.com/2011/04/18/sharepoint-evil-2-the-url-url-is-invalid-it-may-refer-to-a-nonexistent-file-or-folder-or-refer-to-a-valid-file-or-folder-that-is-not-in-the-current-web-the-2nd-scenario/

Advertisements

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Content Types, Custom Fields, Lookup Columns, SharePoint, SharePoint Evils. Bookmark the permalink.

2 Responses to SharePoint Evil #1: The URL ‘[url]’ is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web

  1. Shae says:

    “…those errors that are so ambiguous and misleading that Google will shows 50 hits, with 10 different suggested solutions, and none of them work for your particular case.”

    HA! Awesome idea.

  2. susanjchin says:

    Thank you!! You saved me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s