Uploading Files from Infopath To Sharepoint Library - InfoPath Dev
in

InfoPath Dev

Uploading Files from Infopath To Sharepoint Library

Last post 01-29-2010 01:49 AM by Folke. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-15-2010 05:36 AM

    • Folke
    • Not Ranked
    • Joined on 12-08-2009
    • Posts 4

    Uploading Files from Infopath To Sharepoint Library

    Following Problem:

    Using: Infopath 2007, VSTA, MOSS

    i need to add a specific pdf file to my Sharepoint Document Library. I tried this command but i get the following error

     

    Command: 

    My.Computer.Network.UploadFile("c:\3.pdf", "http://server:33655/pdfs/3.pdf", "username", "password", True, 500)

     

    Error: 

    "System.Net.WebException wurde nicht von Benutzercode behandelt.
      Message="The remote server returned an error: (404) Not Found."
      Source="Microsoft.VisualBasic"
      StackTrace:
           at Microsoft.VisualBasic.MyServices.Internal.WebClientCopy.UploadFile(String sourceFileName, Uri address)
           at Microsoft.VisualBasic.Devices.Network.UploadFile(String sourceFileName, Uri address, ICredentials networkCredentials, Boolean showUI, Int32 connectionTimeout, UICancelOption onUserCancel)
           at Microsoft.VisualBasic.Devices.Network.UploadFile(String sourceFileName, Uri address, String userName, String password, Boolean showUI, Int32 connectionTimeout, UICancelOption onUserCancel)
           at Microsoft.VisualBasic.Devices.Network.UploadFile(String sourceFileName, String address, String userName, String password, Boolean showUI, Int32 connectionTimeout, UICancelOption onUserCancel)
           at Microsoft.VisualBasic.Devices.Network.UploadFile(String sourceFileName, String address, String userName, String password, Boolean showUI, Int32 connectionTimeout)
           at _23._12._09.FormCode.CTRL418_5_Clicked(Object sender, ClickedEventArgs e) in C:\...\FormCode.vb:line 390
           at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
           at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
    "

     This command looks very simple, but i dont get it.

    Have also tried several other commands like my.computer.filesystem.copyfile(...) but it doesn't like URI as source or destination file. {"URI formats are not supported."}

    Btw. exporting views to the Library is no problem (using " Me.CurrentView.Export("http://hansewww:33655/PDFs/" + fileName, ExportFormat.Pdf " ) 

    Thanks for help.

     

     

    edit:

    http://msdn.microsoft.com/en-us/library/w3kksch7(VS.80).aspx

  • 01-28-2010 04:38 PM In reply to

    Re: Uploading Files from Infopath To Sharepoint Library

    Hi there,

    We have a tool called qRules that does this for you, we have already written the code you just need to integrate it into your template:

    http://www.qdabra.com/en/products/qRules.aspx

    qRules has 21 current features, the upload to SharePoint is one of those features.  It works great and for large files it's even better because it simply uploads the file to the SharePoint library and then inserts a link to the file in your InfoPath form so users can access the file later via the link in the form.

    Hope that helps

    Ted

  • 01-29-2010 01:49 AM In reply to

    • Folke
    • Not Ranked
    • Joined on 12-08-2009
    • Posts 4

    Re: Uploading Files from Infopath To Sharepoint Library

    Thanks Ted,

    i managed to write this code myself. That helped me with the task:

    http://www.communardo.de/techblog/2007/05/30/file-upload-in-eine-sharepoint-dokumentenbibliothek-c/

     

    Greetings

    Folke

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.