none
Hyperlink to upload file in a library on another site - gives error "incorrect function, HRESULT 0x80070001"

    Question

  • Using SharePoint 2013 on-prem.

    I have a document library in Site A.

    On Site B, I want to put a hyperlink, which will allow someone to upload a file (and supply data for fields after the upload) into the library on Site A.

    If I create a hyperlink on Site A to this URL, it works fine:

    https://myportal/SiteA/_layouts/15/Upload.aspx?List={D0DF652C-CCC7-4695-9349-3592A72CA09C}&RootFolder=

    It lets me browse for the file and select it. When I click the OK button, it then pops up a dialog to allow me to enter the fields associated with the document library.

    However, if I create the exact same hyperlink on Site B, it lets me browse and select the file, but after I click the OK button, instead of popping up the dialog to let me supply the fields, I get an error:

      Sorry, something went wrong

      Incorrect function (Exception from HRESULT: 0x80070001)

    I am assuming this is because the library is on a different site, but why does it care? Is there a different URL I could use to accomplish this?


    • Edited by Stoonad Wednesday, March 15, 2017 7:39 PM typo
    Wednesday, March 15, 2017 7:36 PM

All replies

  • Hi Stoonad,

    I inserted a hyperlink on a site for uploading a file to another site. When I clicked the link, the upload page opened. After clicking the OK button, I got the page to enter properties for the file.

    It does not care where the library is because it opens a URL.

    For this issue, please check the ULS and Event logs to see if there are more error message about it.

    Try uploading a simple file to check if it works.

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, March 16, 2017 8:16 AM
    Moderator
  • Linda,

    The file does upload (as checked out).

    I also just tried it with another site/library and it did work OK. So it seems to be something related to this particular site/library. The only thing different about it is that the Publishing feature is enabled for pages on the site where the document library is. But it is just a plain document library, no versioning or check in/check out required.

    This is what is in the ULS log.

    03/16/2017 10:03:12.26 	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ai1wu	Medium  	System.Runtime.InteropServices.COMException: Incorrect function. (Exception from HRESULT: 0x80070001), StackTrace:    at Microsoft.SharePoint.SPWeb.GetList(String strUrl)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.get_IsSourceUrlDocumentLibrary()     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.get_SourceUrl()     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.GetEditFormUrl(SPFile spfile)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.OnSubmit(Object o, EventArgs e)     at System.Web.UI.Page.ProcessRequestMain(Boolean ...	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.26*	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ai1wu	Medium  	...includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)   ...	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.26*	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ai1wu	Medium  	...  at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessReques...	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.26*	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ai1wu	Medium  	...tNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28 	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	8nca	Medium  	Application error when access /_layouts/15/UploadEx.aspx, Error=Incorrect function. (Exception from HRESULT: 0x80070001)   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)     at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28 	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	Runtime                       	tkau	Unexpected	System.Runtime.InteropServices.COMException: Incorrect function. (Exception from HRESULT: 0x80070001)    at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)     at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28 	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ajlz0	High    	Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: Incorrect function. (Exception from HRESULT: 0x80070001) ---> System.Runtime.InteropServices.COMException: Incorrect function. (Exception from HRESULT: 0x80070001)     at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)     at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)     --- End of inner exception stack trace ---     at Microsoft.SharePoint.SPGlobal....	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28*	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ajlz0	High    	...HandleComException(COMException comEx)     at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)     at Microsoft.SharePoint.SPWeb.GetList(String strUrl)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.get_IsSourceUrlDocumentLibrary()     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.get_SourceUrl()     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage.GetEditFormUrl(SPFile spfile)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadPage.OnSubmit(Object o, EventArgs e)     at Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPage...	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28*	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	ajlz0	High    	...s.UploadExPage.OnSubmit(Object o, EventArgs e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)	ac99de9d-76bc-e0fa-8d15-86a027aafeda
    03/16/2017 10:03:12.28 	w3wp.exe (0x2A00)                       	0x3F54	SharePoint Foundation         	General                       	aat87	Monitorable	 	ac99de9d-76bc-e0fa-8d15-86a027aafeda


    • Edited by Stoonad Thursday, March 16, 2017 2:16 PM
    Thursday, March 16, 2017 2:14 PM
  • Linda,

    I have done some additional testing. I get the error if I try to use the upload URL to upload into the document library on another site if the document library has a metadata column.

    Example:

    On Site A, create a document library, and add a column to the library. It doesn't matter if it is required or not.

    On Site B, create a link to the URL to upload into the library on Site A.

    When you click the link, it will allow the file to be selected and uploaded, but instead of switching to the EditForm.aspx to get the metadata column value(s), it gives the error.

    However, if I do not add any metadata columns, it never displays EditForm.aspx, but it also does not give any error.

    If I put a link to the upload URL on the same site that contains the library (Site A), it works. But it doesn't work from another site.

    Friday, March 17, 2017 2:32 AM
  • Hi Stoonad,

    Can you upload the file to the library in Site A successfully if you upload it directly to the library?

    For this issue, please use Fiddler to trace when uploading the file.

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, March 21, 2017 1:08 AM
    Moderator
  • Yes, I can upload to the document library directly through the UI.  Also, if I put the link:

    https://myportal/SiteA/_layouts/15/Upload.aspx?List={D0DF652C-CCC7-4695-9349-3592A72CA09C}&RootFolder=

    on a page in SiteA, it works fine.

    The problem occurs when I put this link on a site other than SiteA.

    I can easily reproduce the error.

    1) Create a document library in a site

    2) Add a metadata column to the library (can just be single line of text - doesn't matter)

    3) View the library and click "new document" and choose to upload a document.

    4) In the upload dialog box, right-click on it and copy the URL (should be Upload.aspx). Can cancel then.

    5) Go to another site, click Site Settings/Navigation, and add a link to the navigation by pasting the URL copied in step 4 and save.  Name it something like "Upload to other site".

    6) Click the link created in step 5. It will allow you to browse and choose a file.  Click OK to upload it.

    7) At that point, you will receive the error, when it should pop up the dialog to supply the metadata field added in step 2.

    Note: If you do the same thing above, but instead, create the link on the same site that contains the document library, it will work.

    It's like a context isn't being created by the Upload.aspx file.

    Tuesday, March 21, 2017 1:34 PM