Click here to Skip to main content
15,890,512 members
Articles / Productivity Apps and Services / Sharepoint
Tip/Trick

When Uploading New Document, Getting Error Message as the URL is Invalid When Uploading Documents

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
4 Jul 2016CPOL1 min read 11K   1   1
This tip will help you to resolve an issue with Sharepoint document library. This error occurs when we create new document library and try to upload a document on it, else try to check in the document.

Introduction

I am getting an error message as the URL is invalid or it may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web. This error occurs when we create new document library and try to upload a document on it, else try to check in the document. The existing document libraries work fine with getting any error message.

Background

I tried the following ways to fix the issue:

  1. Verified the content type whether any duplicate columns are created or not
  2. Deactivated the custom content type solution and tried to upload the document
  3. Removed custom content type which is attached in the document library
  4. Tried to find out the issue on the log file
  5. Finally, I got Powershell script to resolve this issue

This issue occurred, duplicate column was created in the basic item content type.

Using the Code

Execute the below Powershell script in your SharePoint server to delete the duplicate column in the base content type.

PowerShell
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
}

$url = 'https://site.url.com'
Disable-SPFeature -Identity Fields -url $url -force
Enable-SPFeature -Identity Fields -url $url
$Site = get-spsite $url
foreach ($web in $site.allwebs)
{
    $lists = New-object System.collections.arraylist
    $web.Lists | % { $lists.add($_) } | Out-Null

    foreach ($list in $Lists)
    {
        $AuthorField = $list.fields.getfieldbyInternalName('Author')
        if ( $Authorfield.schemaXML -notmatch "FromBaseType" )
        {
            Write-host $web.url $list.title -Separator `t`t
            $xml = [xml]$AuthorField.SchemaXmlWithResourceTokens
            $xml.Field.SetAttribute('FromBaseType','TRUE')
            $AuthorField.SchemaXml = $xml.OuterXml
            $AuthorField.Update()
        }
    }
    }
$Site.Dispose()

After executing the above script, restart your IIS.

Points of Interest

I wasted lot of time to resolve this issue. I hope it will be helpful for you to resolve this issue within 2 to 3 minutes.

Please let me know if you are still facing the same issue.

History

  • 4th July, 2016: Initial version created

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
I am Senthil Gopal, a SharePoint Lead based out of Chennai, India.
I have around 9+ years of experience in Microsoft technologies such as C#,Asp.net, SharePoint 2010 and 2013.
This is a Social Group

4 members

Comments and Discussions

 
QuestionNeed help Pin
Member 1314698124-Nov-22 5:57
Member 1314698124-Nov-22 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.