locked
SharePoint IP Download Document 401 Unauthorized Error only on InfoPath files RRS feed

  • Question

  • Hi,

    We are using the SharePoint integration pack available from CodePlex to download a submitted InfoPath form from a SharePoint 2007 document library.  Whenever the policy runs, it fails on the Download Document step with the following message:

    Exception occurred in SharePointDomain::DownloadFile: The remote server returned an error: (401) Unauthorized. Details: Url =<SharePoint URL>, Destination = <local path> Exception: Exception Target site: SharepointDomain.DownloadFile Stack trace: at Opalis.IP.SharePoint.SharepointDomain.DownloadFile(String url, String destination) at Opalis.IP.SharePoint.DownloadDocument.DoExecute() at Opalis.IP.SharePoint.DownloadDocument.Execute(IOpalisRequest request, IOpalisResponse response)

    If we use any other kind of document (Word doc, Excel spreadsheet, etc.), the file downloads successfully, so we are not suspecting a fault in the connection configuration.

    Any pointers would be appreciated!

    Thank you,

    Derek

    Monday, November 28, 2011 8:26 PM

Answers

  • Hi Derek,

    I ran in to the same problem and found that I could add "?NoRedirect=true" on the Download Attachment module. I ran a Get List Item followed by a Download Attachment module. In the Attachment URL field I put "{EncodedAbsUrl from "Get List Item"}?NoRedirect=true". Hope this helps.

    Cheers,

    Mark 

     

    • Marked as answer by DMReinhard Friday, December 16, 2011 3:37 PM
    Friday, December 9, 2011 11:13 PM

All replies

  • A quick Bing search turned this up:

     

    http://knrs.blogspot.com/2010/11/sharepoint-401-unauthorized-when.html

     

    "Today, I got an "401: Unauthorized" exception when calling the WebClient.DownloadFile method to download an Infopath file from SharePoint, even if I provided the correct permissions (setting the WebClient.Credentials property).

    This was because of the Infopath Forms Server feature in MOSS 2007 Enterprise edition. This feature redirects to the /_layouts/FormServer.aspx page, apparently this was resulting in an Unauthorized exception.

    A workaround is to add "?NoRedirect=true" to the url, like this: http://ServerName/sites/SiteCollection/FormLibrary/Form1.xml?NoRedirect=true.

    More information about some Query Parameters you can use on the /_layouts/FormServer.aspx page: http://msdn.microsoft.com/en-us/library/ms772417.aspx "




    Robert Hearn • Sr. Program Manager
    Opalis / System Center Orchestrator

    Monday, November 28, 2011 8:57 PM
  • Hi, Robert,

    I've given this a shot, but to no avail.  Since I do not actually build the SharePoint URL, I'm not sure where to put the NoRedirect.  In the configuration, I tried adding to the end of the "SharePoint Site URL" and "List Name".  I also tried adding to the end of the ID field in the Download Document activity.  All ended with different errors.

    Do you know if this is something that can be configured as the IP currently stands, or must this become a dev request?

    Thanks,

    Derek

    Monday, November 28, 2011 9:15 PM
  •  

    Hi,

     

    Please also see if the issue occurs when downloading the InfoPath form directly via the site. Meanwhile, please check the issue referring to the method in the following Knowledge Base article:

     

    You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version

    http://support.microsoft.com/kb/896861

     

    Hope this helps.

     

    Thanks.
    Nicholas Li - MSFT
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, November 30, 2011 6:58 AM
    Moderator
  • Hi Derek,

    I ran in to the same problem and found that I could add "?NoRedirect=true" on the Download Attachment module. I ran a Get List Item followed by a Download Attachment module. In the Attachment URL field I put "{EncodedAbsUrl from "Get List Item"}?NoRedirect=true". Hope this helps.

    Cheers,

    Mark 

     

    • Marked as answer by DMReinhard Friday, December 16, 2011 3:37 PM
    Friday, December 9, 2011 11:13 PM
  • Hi Mark,

    Just had a chance to get that into our development system, and the Download Attachment module with NoRedirect worked flawlessly.

    Thank you for your help!

    Derek

    Friday, December 16, 2011 3:37 PM
  • This helps! Thx

    Tuesday, February 18, 2014 2:24 PM