Save InfoPath Attachment to SharePoint 2010 Document Library

I have a requirement where the business needs to save an attachment form InfoPath form to SharePoint document library direct.

1: Build the InfoPath form

Create three fields

  • WebSiteURL: string
  • DocLibName: string
  • Attachment: base64Binary

2: Build the Web Service

3: Connect InfoPath to Web Service

For more information, Calling Web Service from InfoPath 2010 with Parameters

4: Verify

Download source files (InfoPath & Web service)

Advertisements

Calling Web Service from InfoPath 2010 with Parameters

In this post I will explain how to call a web service from InfoPath 2010 and how to pass a parameters to this web services and get the result.

I support that we have an existing web services which accept two parameters (int x,int y) and return integer as Sum of x and y.

Below is a screen shot after executing the web service

Now, In InfoPath, let’s start it.

Design your form as below:

Click on Manage Data Connection…

Click Add

Now set a sample values for both X and Y

Here is after I set a test values for X=1 and Y=4

Click Next

Now we define our web service in the form, after that we need to set the parameters and call it.

Click on the button and show its rules as below screen.

Add an Action

Set the values from your fields

Go to your web service connection and select X to set its value from textbox

Do same steps again for Y

Now, add a new action “Query for data

Select your connection and click OK

Now, drag and drop the SumResult field on your form

We finished now, just click F5 to run the form and call the web service.

After your fill the form (x and y) and click the button, you will receive the below warning where you can ignore it

Thanks for reading and sorry for long post 😉