Monday, 24 February 2014

The URL ' ' is invalid. It may refer to a non existent file or folder, or refer to a valid file or folder that is not in the current Web


Hi All,

Today faced very weird issue and couldn’t understand what exact problem is. So I thought I must share this who knows you may already have this kind of problem and you solved it J
I have one custom CBS (Content by Search) web part and which I am deploying through the feature. I have module which uploads the web part in web part gallery. First time it worked well. My custom CBS web part is provisioned well in web part gallery and I could add it on page successfully. But by mistake web part is deleted from gallery by some user. So customer reported bug that they couldn’t provision the web part on the page.

I thought I would re-activate the feature and web part would be again in gallery. So I reactivated the feature but no luck. After reactivating also I couldn’t find web part in web part gallery. Then I am trying to manually upload the web part in web part gallery. When I am trying to manually upload the web part in web part gallery I am getting a following exception in ULS logs

0x2B48        SharePoint Foundation                 Runtime                               tkau        Unexpected        System.Runtime.InteropServices.COMException: The URL '_catalogs/wp/MyCustomWebPart.webpart' 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. [Managed code transition]    at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int64 cbFile, Object punkSPFileMgr, Object punkFFM, Int64 PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields, Guid gNewDocId, SPFi...        b857779c-f5cc-6094-c775-f22d93305018

02/24/2014 11:51:47.47*        w3wp.exe (0x1A7C)                               0x2B48        SharePoint Foundation                 Runtime                               tkau        Unexpected        ...leSaveParams sfsp, SPFileInfo& pFileProps, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagReturn, Byte& piLevel, Int32& pbIgnoredReqProps)     at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int64 cbFile, Object punkSPFileMgr, Object punkFFM, Int64 PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields, Guid gNewDocId, SPFileSaveParams sfsp, SPFileInfo& pFileProps, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& p...        b857779c-f5cc-6094-c775-f22d93305018

Application error when access /_layouts/15/Upload.aspx, Error=<nativehr>0x81020030</nativehr><nativestack></nativestack>The URL '_catalogs/wp/MyCustomWebPart.webpart' 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 punkFile, Int64 cbFile, Object punkSPFileMgr, Object punkFFM, Int64 PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock...        b857779c-f5cc-6094-c775-f22d93305018

 
Fig 1 : Exception
 

I did googled at least for couple of hours for the above exception but no luck. It seems that file is already available in web part gallery but couldn’t visible so I tried several following options:
  1. Verified in SharePoint manager but no such existing file can be found.
  2. Then I accessed web part gallery using powershell but also no such file exist.
  3. I deleted the entries from Recycle Bin but still no luck
Then I renamed the file and uploaded it and wonder happen, it asked me property edit box so I again renamed the name to original name and then different following error:
 


Fig 2: Exception
 
So here my guess was correct that file is in web part gallery but couldn’t see it.
After trying couple of hours for this exception and no luck then finally I renamed the file and uploaded it successfully. This is workaround I need to do and still not understand what exact problem is.
Feel free if you have some thoughts on this or please share your experience in case you have faced similar kind of error and solved.
Thanks!
Enjoy reading J
 
Feel free to comment / feedback if any or if you have any query J 
 
 

2 comments:

Leslie Lim said...

This is a great website, so many people need this information, thanks for providing it.

www.imarksweb.org

Prasham Sabadra said...

Thanks!