Wednesday, September 22, 2010

InfoPath Form Services for SharePoint 2010 is Missing

Yesterday I was working with my new SharePoint 2010 development farm. I had an InfoPath form template (i.e. .xsn file) to deploy. I opened up SharePoint Central Administration and went to the General Application Settings page (i.e. generalapplicationsettings.aspx on the Central Admininstration site). I noticed that the "InfoPath Forms Services" section between "External Service Connections" and "Site Directory" is missing.

Obviously I didn't have the Enterprise version installed. So here's how I solved it:
1. Go to MSDN subscriptions - http://msdn.microsoft.com/en-us/subscriptions/downloads/default.aspx
2. Login and open/expand the Servers link in the left navigation to find the "SharePoint Server 2010" product.
3. In the content panel you'll see the "SharePoint Server 2010 (x64) - DVD (English)" product information display. Click on the "View" link of the "Keys" column. Copy the "Enterprise CAL" product key for use in step #7 below.
4. I opened up SharePoint Central Administration and went to the (i.e. upgradeandmigration.aspx on the Central Admininstration site).
5. In the "Upgrade and Patch Management" section click on the "Convert farm license type" link to bring up the Conversion.aspx page.
6. Enter in the new product key and convert to the "SharePoint Server with Enterprise Client Access License" edition.
7. Now go back to the General Application Settings page in SharePoint Central Administration and you should now see the "InfoPath Forms Services" section with its links.

CopyAppBinContent and Workflow Error with InfoPath Form

Kudos to David Stampfli of Microsoft on his valuable assistance solving this dilemma.

I deployed an InfoPath Form template (.xsn file) to a SharePoint 2010 farm and configured a form library to use this template for new documents. In the InfoPath form a call is made to a custom workflow. Everything appears to be configured correctly. But when I save the form I get the following primary error message:

"Unexpected WinWF Internal Error, terminating workflow Id# f7967a24-ee3b-4056-8513-61a10854058c"

An internal exception has the following message:
Unexpected System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Resources.[............].resources" was correctly embedded or linked into assembly "App_GlobalResources.nkxekvue" at compile time, or that all the satellite assemblies required are loadable and fully signed.


What happened? The page resource files weren't properly deployed to the Web Application on the Farm during the WSP deployment. In order to mitigate this issue we have the CopyAppBinContent command for STSADM. See http://technet.microsoft.com/en-us/library/cc261996(office.12).aspx for more. On the WFE I ran the following command to resolve this issue:

stsadm.exe –o copyappbincontent

Monday, September 20, 2010

Configuring Site Usage Reports

I noticed that my site collection administrators weren't able to see their usage statistics. The issue was that the "Enable advanced usage analysis processing" checkbox was unchecked on the SSP's "Configure Advanced Usage Analysis Processing" screen. Here's what needs to be done to resolve this issue.

1. Open up SharePoint Central Administration
2. Click on the link to the SSP site home page.
3. Click on the link to "Usage Reporting" under the "Office SharePoint Usage Reporting" heading. This is _layouts/SpUsageConfig.aspx on the SSP site.
4. You will be on the "Configure Advanced Usage Analysis Processing" screen. Make sure that both checkboxes for "Enable advanced usage analysis processing" and "Enable Search Query Logging" are checked. Then press OK.
5. Now go to each Site Collection's Features (i.e. _layouts/ManageFeatures.aspx?Scope=Site from the site collection root).
6. If the Reports feature is activated then deactivate it.
7. Now click the Activate button for the Reporting feature.
8. As data is collected the site adminsitrators can use _layouts/SpUsageWeb.aspx on their site to see their site's statistics.
9. As data is collected the site collection administrators can use _layouts/SpUsageSite.aspx on their site collection root to see their entire site collection statistics.

Monday, August 16, 2010

Branding, Design, Skinning, etc. for SharePoint 2010

Microsoft has sure done plenty to improve the look/feel and user experience in SharePoint 2010 over MOSS 2007, WSS, STS, etc. earlier editions of SharePoint. But alas there are always going to be people/groups who will want to spend money on more design customizations. To do so wisely I recommend the following procedures:

1. Think first. The proper term for site look/feel customizations in SharePoint is "branding". You also want your SharePoint 2010 "branding" to be usable long-term so stay tuned in to the key SharePoint 2010 branding strategies so you can have confidence that Microsoft will implement a migration path for future editions of SharePoint.
2. Make the focus of the design changes/implementations to be on the Master Pages. See http://startermasterpages.codeplex.com for a good starting point.
3. Read up on SharePoint 2010 branding. See http://www.sharepointpodshow.com/archive/2009/12/21/sharepoint-2010-branding-episode-40.aspx, http://www.sharepoint911.com/training/Pages/Branding2010.aspx, and http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2009/10/21/spc-customizing-amp-branding-my-sites-in-sharepoint-2010-with-heather-solomon.aspx to get started.
4. Understand the basics of what a WSP is. As you are building branding capabilities such as master pages, CSS, other stylings, etc. you will be doing so in SharePoint Designer, Visual Studio, Notepad, a CEWP or some other tools. Ultimately you'll want them all packaged up in WSP(s) for sustainability, maintainability, reusability, migrations, and collaboration. See http://www.bing.com/search?q=sharepoint+2010+WSP+%22Solution+Package%22 to get the latest info on WSP(s).

Wednesday, August 4, 2010

maxRequestLength and Large File Uploads for Web Server

I had an end user working with InfoPath Form Services in MOSS get an error when he attempted to load large attachments to his InfoPath document. Sure enough there was no httpRuntime tag in the machine.config file on the Web Front Ends (WFE), and thus no maxRequestLength attribute setting. The default value is 4096 which means 4096 kilobytes or 4 Meg. I upped it to 16 meg and the problem went away.

See http://msdn.microsoft.com/en-us/library/e1f13641(VS.71).aspx for technical specifications on the httpRuntime tag and its maxRequestLength attribute.

Here's a snippet of machine.config to demonstrate the concept.

<configuration>
<system.web>
<httpRuntime maxRequestLength=16384 />
</system.web>
</configuration>

You can locate the machine.config file in the MOSS WFE's .NET framework runtime's config directory within the Windows Microsoft.Net directory tree. In my case it was the C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config directory.

Monday, August 2, 2010

Page_Load and OnLoad

Today I relearned an important lesson on the Page_Load and OnLoad event handlers for ASP.Net user controls. We cannot assume that they are one and the same in the page lifecycle. By default Visual Studio will create an event handler for Page_Load when you doubleclick on the designer panel for a user control.



This default behavior of Visual Studio set up a disaster in conjunction with my SharePoint development framework.

In my framework I've created a Framework.Base.BaseUserControl class that inherits from the System.Web.UI.UserControl class. The purpose of this BaseUserControl class is to serve as an ancestor class for all my user controls that get deployed with SharePoint solutions. In addition, the web part wrapper class (i.e. Framework.Base.BaseWebPart) assumes that the wrapped user control descends from this class.

Here's the OnLoad event handler in BaseUserControl.

protected override void OnLoad(EventArgs e)
{
this.MyBaseControlLoadLogic();
base.OnLoad(e);
}

Here's the result in Visual Studio for my user control.


protected override void Page_Load(EventArgs e)
{
base.OnLoad(e);
this.MyControlLoadLogic();
}


Everything compiles. But then all I got was a blank screen. I did some debugging and then discovered my mistake. The base.OnLoad(e) call im my Page_Load was causing a stack overflow that crashed my development web server. All I had to do was rename Page_Load as OnLoad.


protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.MyControlLoadLogic();
}

It worked :)

Thursday, July 29, 2010

Referencing the current user in SharePoint Code

In this example I'm making the assumption that you have a web page or web part hosted in SharePoint that is calling a user control with a C# codebehind (i.e. a .ascx.cs file). The code here is called in the partial class.

There are 2 object references available to use in gathering current user information:

System.Web.HttpContext.Current.User.Identity has a type definition of the System.Security.Principal.IIdentity interface.

Microsoft.SharePoint.SPContext.Current.Web.CurrentUser has a type definition of the
Microsoft.SharePoint.SPUser class.

In my code if my Active Directory account is adegaston on the domain called MyDomain then the output of the following function would be:

"Login:MyDomain\adegaston; Display:Alex Degaston."

private string SampleCode()
{
string loginName = System.Web.HttpContext.Current.User.Identity.Name;
string displayName = Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.Name;
string kFormat = "Login:{0}; Display:{1}.";
return String.Format(kFormat, loginName, displayName);
}