Showing posts with label InfoPath. Show all posts
Showing posts with label InfoPath. Show all posts

Friday, October 2, 2009

The form cannot be displayed because session state is not available

Scenario:
You got the following error while associating a workflow that uses InfoPath form.

Error : The form cannot be displayed because session state is not available.

Solution:
Check you Web.config and Uncomment the Session tag in HTTPModules section like this

Before:

<httpModules>
<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<!-- <add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->
<add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</httpModules>
After:
 <httpModules>
<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</httpModules>

Wednesday, April 8, 2009

Turn off the "Powered by: InfoPath Forms Services" logo

Scenario:
This is very annoying, MOSS web based forms are hosted in a web page and shows Powered by : InfoPath Forms Services, logo. Client didn't like it

Solution:
Luckily, Microsoft has release a hot fix.

Code:

stsadm -o setformsserviceproperty -pn AllowBranding -pv false


Article: KB Alertz

Saturday, November 22, 2008

Getting Current User in Infopath UI

Scenario:
You want to know the currently logged in user name to do some formatting.

Solution:
You can use inbuild function to get the information.

To get the current use name:

username()

These functions are only available in InfoPath 2007.

Getting Current user role in Infopath code-behind

Scenario:
Infopath 2003/2007 has .net language support. In your code you want to do execute some logic depending upon the Logged in User Role.

Solution:
You can use the in-build method to get the role.

Code:


bool userRole = thisApplication.User.IsUserMemberOf(@"Domain\Group");

if (userRole)
{
//do something cool here
}
Notes:
However, there is a catch here. This works only if the user who is accessing the form and the group specified in the user roles are of the same domain.

So, the following are the valid and invalid combinations

Invalid Combination:

User: AMERICA\Employees
Group: ASIA\SecurityGroup

Valid Combination:

User: AMERICA\Employees
Group: AMERICA\Administrators

Tuesday, July 29, 2008

This form template is browser-compatible, but it cannot be browser-enabled on the selected site

Message:
You receive the following message when you try to publish a browser-compatible InfoPath 2007 form template to a SharePoint server with or without Forms Services: "This form template is browser-compatible, but it cannot be browser-enabled on the selected site".

Reason:
Infopath is compatible to be able to display in browser , but SharePoint is not configured for the same.

Resolution:
Configure Forms Services to allow users to browser-enable form templates.

Steps:
1. Open SharePoint 3.0 Central Administration.
2. On the Central Administration page, click on the Application Management tab.
3. On the Application Management page, under InfoPath Forms Services, click Configure InfoPath Forms Services.
4. On the Configure InfoPath Forms Services page, select the Allow users to browser-enable form templates checkbox.
5. Close the InfoPath 2007 client application.
6. Open the InfoPath form template again.
7. Try publishing the template again.