A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Saturday, November 24, 2012

SharePoint 2013 and InfoPath 2013 - Creating Web Enabled Forms

Creating Web Enabled InfoPath Forms

Download this article in PDF form

In this article, you will learn how to create web enabled InfoPath forms. InfoPath is an information gathering tool and is used to create XML forms. People have always been trying to come up with a standard for creating electronic forms. Before InfoPath, companies created electronic forms in different formats. InfoPath has helped companies to adhere to a standard. Coding XML manually may not be an interesting job but creating XML forms with InfoPath has really made this job quite easier.

All clients must have InfoPath installed on their machines in order to open the forms. It could be a problem for smaller companies to provide InfoPath client to all the users. What can be the solution then? Solution is to create web enabled forms that can be opened in web browser without having to install InfoPath client on user machines.

Following is a step-by-step guide that will show you how to create and deploy a web enabled form:

1.      Open InfoPath (Start > All Programs > Microsoft Office 2013 > InfoPath Designer 2013).

2.      Under “Popular Form Templates”, double-click “SharePoint Form Library”.

   


            Fig 1: New Form

Figure 1 shows how the new form looks.

3.      Change the form label. Click on the words “Click to add title” and write “User Registration”.

4.      Change section heading. Click on the words “Click to add heading” in the first section and write “User Information”.

5.      Highlight second section and delete it.

6.      Now it’s time to add labels and controls in the form.  Add following labels and controls in the form. To add a label, click on “Add label” text and enter the label name. To add a control, click “Add control” words and then click control name to add it there. Controls are located under the HOME tab (in “Controls” section). Enter first label called “First Name”. Click “Add label” in the first cell and write “First Name” there. In the second column adjacent to the first cell, click “Add control” and then click “Text Box” in the menu. This will add “Text Box” control in the cell.



Figure 2: InfoPath controls

Right-click the text box and select select “Text Box Properties…”. In the “Field Name”, enter “FirstName” and click OK. You can also rename control by selecting the respective node on the right side and changing the field name in the properties.

Here is the list of all labels and controls.

Label
Control Name
Control Properties
First Name
FirstName
-          Under “Data” tab, change the control name to “FirstName”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
Last Name
LastName
-          Under “Data” tab, change the control name to “LastName”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
Address
Address
-          Under “Data” tab, change the control name to “Address”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”. Check “Multi-line” option.
City
City
-          Under “Data” tab, change the control name to “City”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
State
State
-          Under “Data” tab, change the control name to “State”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
Zip
Zip
-          Under “Data” tab, change the control name to “Zip”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
Phone
Phone
-          Under “Data” tab, change the control name to “Phone”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.
Email
Email
-          Under “Data” tab, change the control name to “Email”.
-          Under “Display” tab, uncheck “Enable spelling checker” and “Enable AutoComplete”.

 

7.      After adding the above controls, there are two more controls to be added yet. Add two buttons at the bottom of the form. We will change button settings later.


 
Figure 3: Complete Form

One of the buttons will submit the form to a SharePoint library and the other button will close the form. To submit form to a library, you need to create a library in SharePoint first.

8.      Go to your SharePoint site. You will create a library at the root site. Open SharePoint site. On the home page, click third image button to add a new library.



Figure 4: Add new library

9.      Under “Apps you can add”, click on “Form Library” icon.


Figure 5: Click Form Library Icon

10.  Enter “User Registration” in the “Name” box and click “Create” button.

11.  Now you have created the library, go back to the form. Click on “Manage Data Connections…” link on the right side (at the bottom).



Figure 6: Manage Data Connections

12.  Click “Add…” button.

13.  Select “Submit data” option and click “Next”.

14.  Select “To a document library on a SharePoint site” and click “Next”.

15.  Enter the document library path in the “Document Library” box. For example, “http://yourservername/UserRegistration”.

16.  Click function (fx) button to create file name.

17.  Click on “Insert Function” button. From the “Functions”, select “concat” and hit OK.

18.  The file name will comprise of user’s first name and last name. You will concatenate both fields to create the file name. Double-click first field to insert first name and select “FirstName” from the fields. Click OK.  Double-click second field and select “LastName”. Click OK. Remove third field from the concat function, that is not needed. Click OK.

19.  Check “Allow overwrite if file exists” and click “Next”.



Figure 7: Data Connection Wizard

20.  Click “Finish”. Click “Close”.

21.  Right-click first button on the form and select “Button Properties…”. From the “Action” drop down, select “Submit”.

22.  Click “Submit Options…”.

23.  Check “Allow users to submit this form”.

24.  From the first drop down, select “SharePoint document library”.

25.  From the second drop down, select the connection that you created for data submission. The default name of the connection was “SharePoint Library Submit”. Select this in the drop down. Click OK.

26.  Right-click second button and select “Button Properties…”.  By default, “Action” drop down will have “Rules and Custom Code” selected. Keep that option selected. Change “Label” to “Close”. Change “ID” to “btnClose”. Click OK.

27.  “Rules” pane will automatically open on the right side. If that does not happen, click “Close” button and then click “Manage Rules” button in the ribbon. That will open rules pane. Click “Add” button in the pane to add new action and select “Close the form”.




Figure 8: Add Rule

28.  “Rule Details” dialog box will open. Make sure “Action” drop down has “Close the form” option selected. Click OK.

29.  Save the form at this stage. Now the pending work is to change submit options. From the “File” menu, click “Info” and then click “Form Options” button.

30.  Select “Web Browser” category.  Uncheck “Show InfoPath commands in Ribbon or toolbar”.

31.  Select “Property Promotion” category. Click “Add” and select “FirstName”. Similarly, add all other fields one by one. These promoted fields will be available to be added to the library view.

32.  Select “Security and Trust” category. Uncheck “Automatically determine security level (recommended). Select “Full Trust” option.

33.  Select “Compatibility” category. Make sure “Form type” has “Web Browser Form”. In “Server validation” section, enter “http://yourservername/_vti_bin/FormsServices.asmx”. Replace “yourservername” in the URL with your actual server name.

34.  Click OK.

35.  It’s time to publish the form now. From “File” menu, select “Publish” and then click “SharePoint Library”.

36.  Enter your server URL and click “Next”.

37.  Make sure “Enable this form to be filled out by using a browser” is selected. Click “Next”.

38.  Browser to the folder where you want to save the published form. Enter “UserRegistration” in the file name box. Click “Save”.

39.  Click “Next”

40.  Click “Next”.

41.  Click “Publish”.

42.  Click “Close”
Uploading The Published Form

 
43.  There are two ways to upload the published web form to SharePoint: Using the interface provided by SharePoint and using PowerShell. You will use the first option in this exercise. Open "SharePoint Central Administration" site by selecting Start > All Programs > Microsoft SharePoint 2013 Products > SharePoint 2013 Central Administration.

44.  Select “General Application Settings” and click “Upload form template”.



Figure 9: Upload form template

45.  Click “Browse”  button to browse to the folder where form was published and select the published form. Click “Upload” button. You will see a message telling you that form has been uploaded. Click OK.

46.  Still on the same page (Manage Form Templates), right-click the newly uploaded form and select “Activate to a site collection”. Make sure correct site collection is selected in the “Activation Location” section and click OK. In case you get an error, try activating it from the site collection features in the SharePoint site. Here is how you do it. Go to SharePoint site. Click “Site Contents” link on the left side. Click “Settings” link. It will be under the search box. In “Site Collection Administration” section, click “Site collection features” link. Locate “UserRegistration” text and click “Activate” button in the same row.

Figure 10: Activated Feature

Preparing Forms Library

 

47.  Go to the “UserRegistration” library. Click “LIBRARY” tab at the top.

48.  Click “Library Settings” button in the ribbon.

49.  Click “Advanced Settings” link.

50.  Set “Allow management of content types?” to “Yes”.

51.  Set “Make ‘New Folder’ command available?” to “No”.

52.  Keep all other default values and click OK.

53.  On the library settings page, in “Content Types” section, click “Add from existing site content types” link.

54.  From the list of available site content types, select “UserRegistration” and click “Add” button. This will add the content type to the library. Click OK.

55.  Click “Change new button order and default content type” link. Uncheck “Form” option and click OK.

56.  Go back to the main library page and click the new document link. The form will open in browser. Fill it out and click Submit. Also try to the Close button. This is how the final form looks like:



Figure 11: Completed form ready for submission

After the form is submitted, open it again by clicking the form name and then close it by hitting the “Close” button.

This was a simple form used to demonstrate the creation and publishing process. You have seen the publishing method. Now you can design simple forms as well as complicated ones. The publishing method does not change. Only form layout and design will change. For complicated forms, programming can be done in Visual Studio.

Download this article in PDF form

 

Thursday, November 22, 2012

SharePoint 2013: AAM configured URL redirects to another URL

TIP

If you have setup two URLs in the same zone  in Alternate Access Mappings then the second URL will redirect to the first one. To resolve the problem, change the zone of one of the URLs. For example, you can choose Custom for one the zones. Now both URLs will work.

SharePoint Designer 2013: Data Source Type is empty

If you are creating an external content type in SharePoint Designer 2013 and you get empty data source type when adding a connection then most probably you are using a Preview version of the designer. SharePoint Designer 2013 Preview has a problem. It does not load data source type drop down. To reproduce the problem:

1, Open SharePoint designer 2013 Preview.
2. Under Site Objects, click External Content Types.
3. Click External Content Type button in the ribbon.
4. In the section "External Content Type Information", field "External System", there is a link "Click here to discover external data sources and define operations". Click it.
5. Click Add Connection button. The drop down will be empty.



The only solution, as far as I know, is to use SharePoint Designer 2010 or SharePoint Designer 2013 RTM. Good thing, this has been fixed in the 2013 RTM version.
 

SharePoint 2013 - Setup multiple URLs in DNS and configure Alternate Access Mappings


In the previous article “SharePoint 2013 - Setup DNS and use FQDN to access SharePoint sites” you learned how to setup DNS and use FQDN to access sites in SharePoint 2013. In this article, you will learn how to add new URLs for different sites (departments). For example, you can setup a URL for your finance department, HR department, etc.

1.       Now you have setup the domain services, you can use multiple URLs to access SharePoint sites. As mentioned in previous article, one way to access your SharePoint site is to use the machine name in the URL, for example, http://sp2013 (sp2013 is the machine name). With domain setup on your server, you can now access same site using URL like http://sp2013.walisystems.com. Please note that walisystems.com is the FQDN. Now, the fun part starts. We will setup a new URL www.walisystems.com to access your root site collection.

2.       Open Server Manager. Expand Roles. Expand DNS. Expand MACHINENAME. Expand Forward Lookup Zones. Right-click FQDN and select New Host (A or AAAA)….


3.       In the Name box, enter www. In the IP address, enter IP.

 



To find the IP of your machine, go to command prompt and run IPCONFIG command. Note down IPv4 Address. This is the IP of your machine.



After entering the IP, click Add Host button. This will add a new A record.

 



4.       Now, we will create a new web application and site in SharePoint that will use this new URL. Open Central Administration site. Click Application Management. Click Manage web applications.

 



You will see there are two web applications (if it’s a new setup). One is your main site and the other central administration site.

5.       Click New button in the ribbon to create a new web application. A form will open.




 
6.       Enter 80 in the Port. Enter www.walisystems.com (Your A Record that you created above) in the Host Header. Keep all other default values and click OK.

 

7.       Next, create a new site collection. On the Application Management page, click Create Site Collections. From the Web Application drop down, select newly created web application.

 

8.       Enter Title and Description of the site collection.

 

9.       In Web Site Address section, in URL drop down, select / (front slash) for the root site collection. You can only create one top level site collection per web application. For more site collections, you have to create managed paths. There is a link called Define Managed Paths in Web Site Address section (on the same page). Also, if you have already used root site collection, Create Site Collection page will automatically show you /sites/  managed path. If you want to use a managed path then you have to enter a site collection name in the text box after the drop down.

 

10.   In the Template Selection, keep 2013 selected in the experience version drop down. Keep Team Site  selected under Collaboration tab.

 

11.   Enter Primary Site Collection Administrator.

 

12.   Click Ok to create site collection.

 

13.   When new web application is created, a default entry is automatically added in the Alternate Access  Mappings. To see the new entry for your web application, on the Application Management page, click Configure alternate access mappings. You will see new web application listed and the zone will be Default.

 

14.   Now, let’s add another URL for the HR department. Repeat steps 2 and 3 above to add a new host entry but instead of entering www, enter hr. IP will remain same.

 

15.   Now, you can create a new web application and site collection for the HR department just like you did above OR you can use an existing web application. You have already seen how to create new web application and use new URL. Now you will existing web application that you created above and use Alternate Access Mappings to forward new URL to that web application.

 

16.   On the Application Management page, click Configure alternate access mappings link.

 

17.   Click Add Internal URLs.

 

18.   From the Alternate Access Mapping Collection drop down, select the newly created web application.

 

19.   Enter new URL (new host entry for the HR department, for example, http://hr.walisystems.com) in the URL protocol, host and port field.

 

20.   In the Zone drop down select Custom.

 

21.   Click Save.

 

22.   Open new URL (http://hr.walisystems.com) in the browser. Your new site collection will open.

 

 

I hope information in this article was useful for you. Please do leave feedback in the comments below.  Thanks for reading!