PowerShell tip to Identify lists with InfoPath Forms associated in SharePoint 2016 by using the Property “_ipfs_infopathenabled”

Sathish Nadarajan
 
Solution Architect
February 15, 2018
 
Rate this article
 
Views
4289

 

To identify whether a list is associated with InfoPath Form or not, we have a Property called _ipfs_infopathenabled, which will have a value of True. If the list is not attached, the property itself will not be available.

And specifically, the infopath can be associated to any of the content type. Hence, we need to iterate through the content types in the list and identify whether any of the content type is having the property or not.

 function AddPowerShellSnapin()
 {
     try
     {
         Add-PSSnapin "Microsoft.SharePoint.PowerShell"
         Write-Host "Adding PowerShell Snap-in" -ForegroundColor Yellow
         # Try to get the PowerShell Snappin.  If not, then adding the PowerShell snappin on the Catch Block
         Get-PSSnapin "Microsoft.SharePoint.PowerShell" 
     }
     catch
     {
         if($Error[0].Exception.Message.Contains("No Windows PowerShell snap-ins matching the pattern 'Microsoft.SharePoint.PowerShell' were found"))
         {
             Add-PSSnapin "Microsoft.SharePoint.PowerShell"
         }
     }
     
     Write-Host "Finished Adding PowerShell Snap-in" -ForegroundColor Green
     
 }
 
 function IsInfoPathUsed($List)
 {
     $InfoPath_Used = "False"   
         
     foreach($contentType in $list.ContentTypes)
 	{
 		$InfoPath_Used = $contentType.ResourceFolder.Properties[“_ipfs_infopathenabled”]
 		if($InfoPath_Used -eq "True")
 		{
 			break;
 		}
 	}	
     
     return $InfoPath_Used
 }
 
 AddPowerShellSnapin
 
 $Web =  Get-SPWeb "http://sathishserver:555/sites/developersite"
          
         # Get the Lists    
         $Lists = $Web.Lists
         
         # Iterate through the Lists
         foreach($List in $Lists)
         {
             write-Host "Get Lists With InfoPath in -" + $List.Title
              
                 $IsInfoPathUsed = IsInfoPathUsed($List)
                 if($IsInfoPathUsed -eq "True")
                 {
                     $output = $_.SiteCollectionURL + "," + $Web.Url + "," + $List.Title + "," + $List.DefaultViewUrl 
                     Add-Content $ListsWithInfoPath_CSV_Path $output
                 }
           } 
 

Happy Coding,

Sathish Nadarajan.

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

SharePoint 2013 – InfoPath WebPart – Redirect to home page after “The form has been closed” Message

Sathish Nadarajan
 
Solution Architect
February 26, 2016
 
Rate this article
 
Views
10306

In a recent requirement, I created a Blank WebPart Page and on which, we need to add a InfoPath WebPart. The InfoPath WebPart will be available as shown in the below screen shot.

clip_image002

Once, added the WebPart, we need to map the Form to the WebPart. That I am leaving to the readers.

Now, the caveat here is, if the InfoPath Form within the WebPart is closed, then I want the Page to be redirected to the home page or some other page.

clip_image004

There is no default methods for this with the WebPart or even we cannot inject the Javascript to the InfoPath Forms directly. Hence, after some investigation, I found an interesting piece of script.

On the same page, Added a Script Editor WebPart or a Content Editor WebPart and add the below Javascript to it.

 $(document).ready(function(){
     if($('#DialogFinalMessage > div').html().length>0){
         window.location.href = "<Desired destination page URL>"
    }
 });
 

It worked like charm. After the form has been closed, this script will redirect our page to the desired destination.

Happy Coding,

Sathish Nadarajan.

Category : Infopath, SharePoint

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Error: JSON is undefined. Infopath Form People Picker in SharePoint 2013

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Views
9854

Recently our customers were upgraded from their IE10 to IE11 on the entire Stakeholders machine. At that time, we faced a strange exception with the InfoPath Forms. We had some People Picker in the Infopath Form. But, when trying to click on the People Picker, we got an exception like “Json is undefined”.

After some analysis, we found that, this is a known defect with the Microsoft and it is being fixed on the subsequent Knowledge Bases. http://support.microsoft.com/en-us/kb/2880473 But even, then there are many information revolving around this error like, whether this is fixed on the April CU or March CU etc., We don’t want to take any assumptions as this is been an existing system.

Hence, we wanted to fix this by the coding level. Actually the fix was very simple, but it requires an update on the Layouts File. (Which many customers may hesitate, but there is no harm in it)

Open the PeopleDialog.master from the Layouts Folder.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS

1. Add the DocType at the top of the File.<!DOCTYPE html>

2. Update the Line <meta http-equiv="X-UA-Compatible" content="IE=10"/> with <meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />

The Updated file looks like below. The same can be copied and pasted.

 <!DOCTYPE html>
 
 <%@ Assembly Name="Microsoft.SharePoint.ApplicationPages"  %>
 <%@Master language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.PickerDialogMaster"%>
 <%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 <%@ Register TagPrefix="wssuc" TagName="LinksTable" src="/_controltemplates/15/LinksTable.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="/_controltemplates/15/InputFormSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="/_controltemplates/15/InputFormControl.ascx" %> <%@ Register TagPrefix="wssuc" TagName="LinkSection" src="/_controltemplates/15/LinkSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="/_controltemplates/15/ButtonSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ActionBar" src="/_controltemplates/15/ActionBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBar" src="/_controltemplates/15/ToolBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="/_controltemplates/15/ToolBarButton.ascx" %> <%@ Register TagPrefix="wssuc" TagName="Welcome" src="/_controltemplates/15/Welcome.ascx" %>
 <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 <html lang="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,language_value%>' EncodeMethod='HtmlEncode'/>" dir= "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,multipages_direction_dir_value%>' EncodeMethod='HtmlEncode'/>" >
 <head runat="server">
 	<meta name="GENERATOR" content="Microsoft SharePoint" />
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 	<meta http-equiv="Expires" content="0" />
 	<meta http-equiv="Pragma" content="no-cache" />
 	<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
  
 	<title id="onetidTitle"><asp:ContentPlaceHolder id="PlaceHolderDialogHeaderPageTitle" runat="server"/></title>
 	<SharePoint:CssLink runat="server"/>
 	<SharePoint:CssRegistration name="corev4.css" runat="server" />
 	<SharePoint:Theme runat="server"/>
 	<SharePoint:ScriptLink language="javascript" name="core.js" localizable="false" runat="server" />
 		<SharePoint:ScriptBlock runat="server">
 			function showWaitCursor(fIsOK)
 			{
 				if(document.all)
 				{
 					for (var i=0; i<document.all.length; i++)
 					{
 						document.all(i).style.cursor="wait";
 					}
 					return true;
 				}
 			}
 			function checkForEsc(e)
 			{
 				if(!e)	e = window.event;
 				var key = e.keyCode;
 				if(key==27)
 					doCancel();
 			}
 			function disableOK()
 			{
 			    <% if (btnOk != null) { %>
 					var ok=(document.getElementById("<%= btnOk.ClientID %>"));
 					ok.disabled=true;
 				<% } %>
 			}
 			function enableOK()
 			{
 			    <% if (btnOk != null) { %>
 					var ok=(document.getElementById("<%= btnOk.ClientID %>"));
 					ok.disabled=false;
 				<% } %>
 			}
 			function doCancel()
 			{
 				window.parent.close();
 			}
 			function doClickOK()
 			{
 			    <% if (btnOk != null) { %>
 					var ok=(document.getElementById("<%= btnOk.ClientID %>"));
 					ok.click();
 				<% } %>
 			}
 			function setSize()
 			{
 				var tbl=document.getElementById('mainTable');
 				if(tbl==null || tbl.offsetWidth<300)
 				{
 					window.parent.w=525;
 				}
 				else
 				{
 					window.parent.w=tbl.offsetWidth;
 					window.parent.h=tbl.offsetHeight;
 				}
 			}
 		</SharePoint:ScriptBlock>
 		<base target="_self"/>
 	<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>
 </head>
 <SharePoint:ScriptBlock runat="server">
 var loaded=false;
 </SharePoint:ScriptBlock>
 <body onload="javascript:_spBodyOnLoadWrapper(); try { if(parent)parent.document.title=document.title;setSize();loaded=true; } catch (e) {}" onkeypress="checkForEsc(event);">
 <form runat="server" method="post" onsubmit="if (typeof(_spFormOnSubmitWrapper) != 'undefined') {return _spFormOnSubmitWrapper();} else {return true;}">
 	<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />
 <SharePoint:FormDigest runat=server/>
 <table class="ms-main" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" id="mainTable">
 <!-- Dialog title section begins -->
 <asp:ContentPlaceHolder id="PlaceHolderDialogTitleSection" runat="server">
 <tr>
 	<td colspan="2">
 		<table border="0" cellpadding="0" cellspacing="0" width="100%">
 			<tr style="padding-bottom: 4px;">
 				<td width="15px"> </td>
 				<td	width="0">
 					<asp:ContentPlaceHolder id="PlaceHolderDialogImage" runat="server">
 						<img id="onetidtpweb1" src="/_layouts/15/images/settings.gif?rev=23" alt="" height="49" width="49"/>
 					</asp:ContentPlaceHolder>
 				</td>
 				<td	valign="top" width="100%">
 					<table	width="100%" cellspacing="0" cellpadding="0">
 						<tr>
 							<td class="ms-titlearea	ms-pageidta">
 								<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
 									<SharePoint:ProjectProperty Property="Title" runat="server"/>
 								</asp:ContentPlaceHolder >
 							</td>
 						</tr>
 						<tr>
 							<td	class="ms-pagetitle ms-pageidpt" valign="bottom">
 								<asp:ContentPlaceHolder id="PlaceHolderDialogTitleInTitleArea" runat="server">
 								</asp:ContentPlaceHolder>
 							</td>
 						</tr>
 					</table>
 				</td>
 				<td class="ms-nav"  align="right" valign="bottom" width="0" nowrap="nowrap">
 					<asp:ContentPlaceHolder id="PlaceHolderHelpLink" runat="server">
 						<a href='javascript:HelpWindowKey("<% = HelpKey %>")'><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_helplink_text%>" EncodeMethod='HtmlEncode'/></a>
 					</asp:ContentPlaceHolder >
 				</td>
 			</tr>
 			<tr>
 				<td	height="4"></td>
 			</tr>
 			<tr>
 				<td class="ms-sectionline" colspan="3" height="2"><img src="/_layouts/15/images/blank.gif?rev=23" width='1' height='1' alt="" /></td>
 			</tr>
 			<tr>
 				<td colspan="3" class="ms-descriptiontext"	style="padding-top: 8px; padding-bottom: 12px;">
 					<asp:ContentPlaceHolder id="PlaceHolderTitleDescription" runat="server">
 					</asp:ContentPlaceHolder>
 				</td>
 			</tr>
 		</table>
 	</td>
 </tr>
 </asp:ContentPlaceHolder>
 <!-- Dialog	title section ends -->
 <!-- Dialog Body Section Begins -->
 <tr height="100%">
 	<td width="100%" height="100%"><asp:ContentPlaceHolder id="PlaceHolderDialogBodySection" runat="server"/></td>
 </tr>
 <!-- Dialog Body Section Ends -->
 <!-- Dialog Button Section Begins -->
 <tr>
 	<td width="100%">
 	    <asp:ContentPlaceHolder id="PlaceHolderDialogButtonSection" runat="server">
 		<table id='Buttons' cellspacing="0" cellpadding="0" width="100%" border="0">
 			<tr height="10"><td colspan="4"></td></tr>
 			<tr>
 				<td width="100%" colspan="4">
 					<asp:ContentPlaceHolder id="PlaceHolderDialogPrebuttonSection" runat="server"/>
 				</td>
 			</tr>
 			<tr>
 				<td width="100%"><img src="/_layouts/15/images/blank.gif?rev=23" width='1' height='1' alt="" /></td>
 				<td> </td>
 				<td nowrap="nowrap">
 				    <asp:Button UseSubmitBehavior="false" runat="server" class="ms-ButtonHeightWidth" OnClick="BtnOk_Click" Text="<%$Resources:wss,multipages_okbutton_text%>" id="btnOk" accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
 				    <span id="idSpace" class="ms-SpaceBetButtons"></span>
 					<input type="button" id="BtnCancel" class="ms-ButtonHeightWidth" value="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,multipages_cancelbutton_text%>' EncodeMethod='HtmlEncode'/>" onclick="if (window.frameElement) { window.frameElement.cancelPopUp(); return false; } else { doCancel(); }" accesskey="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,cancelbutton_accesskey%>' EncodeMethod='HtmlEncode'/>"/>
 				</td>
 				<td width="15px"><img src="/_layouts/15/images/blank.gif?rev=23" width='15' height='1' alt="" /></td>
 			</tr>
 			<tr height="10"><td colspan="4"></td></tr>
 		</table>
 		</asp:ContentPlaceHolder>
 	</td>
 </tr>
 <!-- Dialog Button Section Ends -->
 </table>
 </form>
 </body>
 </html>
 

Happy Coding,

Sathish Nadarajan.

Category : Infopath, SharePoint

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Infopath forms services not found in SharePoint 2010

Sarath Babu Koneti
 
SharePoint Consultant
January 5, 2014
 
Rate this article
 
Views
14484

When we tried to open InfoPath for forms creation we got this message.

clip_image002

When we tried to go to InfoPath forms services in Central administration we were not able to find it.

When we started to look at it, we were able to fix it up by the following ways.

Steps to replicate:

Navigate to SharePoint 2010 -> Central Administration -> General application settings

Not able to find Infopath forms services below as shown below.

clip_image004

To activate Infopath forms services, Open PowerShell with administrator privileges and run the below commands.

clip_image006

clip_image008

Also activate the web scoped feature.

Now login to Central administration & click general application settings, we will be able to see Infopath forms services.

clip_image010

Happy SharePointing

Sarath Babu Koneti

Sharepoint Consultant

Yes Labs Pty Ltd.

Category : SharePoint

Author Info

Sarath Babu Koneti
 
SharePoint Consultant
 
Rate this article
 
Working as a Sharepoint Consultant ~ Yes Labs Pty Ltd, Sydney ...read more
 

How to create and publish InfoPath in SharePoint 2013

Anne Jes Medon
 
SharePoint Developer
April 6, 2013
 
Rate this article
 
Views
65345

InfoPath is helpful to create Reports in SharePoint 2013. This article describes how to create an InfoPath Form and Publish Report using SharePoint 2013.

Create a list and a document library in your site collection. Create a list is for creating items and Document Library is for saving the documents/Reports.

Step 1:

Open SharePoint and create new list. Click Customise Form from Ribbon, which opens to InfoPath designer.

image

Step 2:

Add a table from custom table of File Ribbon or you can make your own Reports from MS-Word to InfoPath

image

Delete Title and attachments table, whereas uncheck the required validator for Title in the field.

Step 3:

Add Fields from the Controls Ribbon, corresponding to your requirement and right click fields to change the Properties name.

image

Step 4:

After adding the fields, add button for saving the data from InfoPath to Library/List and click the Control Properties.

image

Step 5:

Select Submit from Action Dropdown, then proceed to Submit Options button. Select SharePoint doc Library from the dropdown and click Add.

image

Step 6:

This will take to Data Connection Wizard and provide the Document library URL into it.

image

Step 7:

Give the name of the form and finish.

Step 8:

Go to file menu and click Publish.

Step 9:

The page redirects to the SharePoint list page and add new item to your report and submit.

Step 10:

Now click the Reports Document library from the Quick launch, you can see the document that saved in to the Document Library.

image

Step 11:

The final output will be as below

image

Category : Infopath, SharePoint

Author Info

Anne Jes Medon
 
SharePoint Developer
 
Rate this article
 
Works as SharePoint Developer in Chennai, India. ...read more
 

Leave a comment