Tuesday, July 23, 2013

Publishing a full trust form on Sharepoint site

Form that contains connection to database or link outside the share-point site needs to be submit through the Share-point Management site with administrator approval.without it you cannot submit that form otherwise it'll return error "An error occurred while submitting the form." .See below steps to use a full trust form on sharepoint site.


Step 1. Open your form in Microsoft Office Infopath

Step 2.
1. GoTo File --> publish

2. A dialog box will appear with message "The form template must be saved before it can be published. Click OK to save and Cancel to continue working."

3. Click on "OK" and save this form to a location.

4. Now you'll see a option "Where do you want to publish the form template", enable "To a sharepoint server with or without Infopath form services" option.

5. Now Enter the location of your share point or infopath form services site (ex:- https://ap.sitename.ab/)

6. Click on next

7. if a security alert dialog box appears click "Yes" on it.
8. Now if dialog box appears to enter sharepoint site password then enter password in it and click ok.
9. now wait for some movement , it'll take time to connect to that sharepoint site server.
10. now on next window enable "Enable this form to be filled out by using a browser" option
11. also enable "Administrator- approved form template" option
12. Now click on next
13. now select a location and file name for the template form
14. click on next
15. again click on next
16. No click on Publish and then close
So form template is published to the location you selected.

Step 3.
Now the next step is to upload this published form to sharepoint site
1. Open your sharepoint Management site
2. Click on "Application Management" option on left side.
3. Now Under "Manage Form Templates" option click on "Upload Form Template" option.
4. Select form template you published earlier using file upload control on form.
5. first click on "Verify" to verify this form (This option is to check any errors on form)
6. if there's no error on form, click upload button.
now our form is uploaded to sharepoint site.

Step 4.
The Next step is to Activate it for our site.
1. Open site.
2. Click on Site Action
3. Select Site Settings and then Modify all site settings
4. select Site Collection Features.You should now see the InfoPath template there as a deactivated feature. Click the 'Activate' button to activate it

Step 5.
Now adding form on site library
Now once we have created a Forms Library we can go and add our InfoPath form as a content type.
1. From your forms library default view go : Settings -> Form Library Settings -> Advanced Settings.
2. From here, click the radio button to say Yes to the "management of content types". and also enable option "Display as a web page" . click OK.
3. Back in the Form Library Settings find the link to 'Add from existing site content types'. From the list of available content types find the name of your InfoPath form, and click the add button

Now form is ready to submit its data on web-service.Open library and select your form, fill data in it and click on submit.Now you can check this data in database.

Friday, April 24, 2009

How to add Sharepoint username in InfoPath 2007 forms

The following steps will help you to add current logged in sharepoint username in infopath forms.

1. Create a new form by Designing a New Form Template
2. Choose blank form Add a text box to the form ("UserName")
3. Go to Tools Form Options
4. Go to the Open Behavior section and click on Rules
5. Add Action to Set a Field's Value
6. Choose the field you added above as the field to populate
7. For the value, click on the Fx button and choose Insert Function
8. View "All" in the Categories drop down
9. At the bottom you'll see userName, pick it
10. The formula that gets dropped in is userName()

Now preview this form, you'll see your UserName in "UserName" field.


Thanks,
Vikas Sharma

Thursday, April 23, 2009

Publishing a full trust form on Sharepoint site

Infopath forms that contains connection to database or link outside the share-point site needs to be submit through the Share-point Management site with administrator approval. without it you cannot submit that form otherwise it'll return error "An error occurred while submitting the form." .

Below are the steps to use a full trust form on sharepoint site.

Step 1. Open your form in Microsoft Office Infopath

Step 2. In this step we'll publish the form.
1. GoTo File --> publish
2. A dialog box will appear with message "The form template must be saved before it can be published. Click OK to save and Cancel to continue working."
3. Click on "OK" and save this form to a location.
4. Now you'll see a option "Where do you want to publish the form template", enable "To a sharepoint server with or without Infopath form services" option.
5. Now Enter the location of your share point or infopath form services site (ex:- https://your.sitename.com/)
6. Click on next
7. If a security alert dialog box appears click "Yes" on it.
8. Now if dialog box appears to enter sharepoint site password then enter password in it and click ok.
9. Now wait for some movement , it'll take time to connect to that sharepoint site server.
10. Now on next window enable "Enable this form to be filled out by using a browser" option
11. Also enable "Administrator- approved form template" option
12. Now click on next
13. now select a location and file name for the template form
14. Click on next
15. Again click on next
16. Now click on Publish and then close
So our form template is published to the location we selected.

Step 3. Now in this step we'll upload this published form to sharepoint site.
1. Open your sharepoint Management site
2. Click on "Application Management" option on left side.
3. Now Under "Manage Form Templates" option click on "Upload Form Template" option.
4. Select form template you published earlier using file upload control on form.
5. first click on "Verify" to verify this form (This option is to check any errors on form)
6. If there's no error on form, click upload button.
now our form is uploaded to sharepoint site.

Step 4. The Next step is to Activate it for our site.
1. Open site.
2. Click on Site Action
3. Select Site Settings and then Modify all site settings
4. Select Site Collection Features.You should now see the InfoPath template there as a deactivated feature. Click the 'Activate' button to activate it

Step 5. This step is to add activated form to a form library.
Now once we have created a Forms Library we can go and add our InfoPath form as a content type.
1. From your forms library default view go : Settings -> Form Library Settings -> Advanced Settings.
2. From here, click the radio button to say Yes to the "management of content types". and also enable option "Display as a web page" . click OK.
3. Back in the Form Library Settings find the link to 'Add from existing site content types'. From the list of available content types find the name of your InfoPath form, and click the add button


So that's it, now our form is ready to submit data on web-service. Now open that form library and select your form, fill data in it and click on submit.you can now check this data in database.


Thanks,
Vikas Sharma

Submitting data from Infopath form to SQL Server database using WebService

Step 1. Create a Form with some fields.

Step 2. Make that form Full trust using following steps
1. Select Tools --> Form options
2. Select "Security and Trust" menu item from left.
3. Enable Full trust option "Full Trust (The form has access to files and settings on the computer)"

Step 3. Create a webservice that can read this form XML and insert data into SQL Server

Step 4. Add a Submit button on form to submit its data to SQL Server,follow below steps for this
1. Add a button on form from controls box.
2. Right click on that bottom and click on "Button Properties".
3. Now from the "Action" dropdown select "Submit" option.
4. There'll be a button below it "Submit Options",click on it.
5. Enable "Allow user to submit this form" option.
6. Select "Web-Service" option from the dropdown.
7. There'll be a button "Add" under heading "Choose a data connection for submit" , click on it.
8. Enter location of the web-service you want users to submit their form to(Virtual path of web-service like http:\\ws.abc.com\\MyService.asmx).
9. Click on next.
10. Now Select method (from left side menu) in which you want to submit this form.
11. Click on next.
12. Enable "Entire form (XML document, including processing instructions)" option.
13. Click on next.
14. Now Enter a name for this data connection.
15. Click on Finish.
16. Now click on OK on other window.
17. Now click Apply and and then OK.


So now the button on form is ready to submit this form to a web service. you can now submit this form data to Web Service.

But ! , without publishing this form to share-point site you cannot submit this form.Please read other post "Publishing a full trust form on share-point site" to publish this form on sharepoint site.


Thanks,
Vikas Sharma