Tuesday, March 24, 2009

"SharePoint designer encountered an error generating the task form" error caused by using IP address instead of machine name

Never use IP address instead of machine name while using SharePoint Designer. You can save yourself some time NOT trying to solve the problems caused by that…

I was playing with some SharePoint Designer workflows the other day and was getting “SharePoint designer encountered an error generating the task form” error all the time. And yes, the moment I changed IP to machine name, the problem was gone. And that is not the first error in my practice I had because of that issue.

Tuesday, March 10, 2009

Creating and customizing SharePoint 2007/MOSS Central Administration Application Pages

Some time ago I got a task create my own SharePoint Central Admin Page. I did start googling and going through different blogs but found almost nothing. Some tips here and there and that’s pretty much it. When I was finally done, I decided that I should structure all my experience whenever I get a chance. So, finally, half a year later I decided to start this blog with this article.

A brief introduction

SharePoint Central Admin Pages physically located inside \12\Admin folder. If you want to look through how some of the current Central Admin Application Pages function, you may use .NET Reflector on Microsoft.Sharepoint.ApplicationPages.Administration.dll and Microsoft.Office.Server.UI.dll. It is respectively located inside of \12\CONFIG\ADMINBIN folder and Assembly Cache.

Review out-of-the-box pages.

Lets review existing MOSS out-of-the-box Central Administration Application Pages:
PageInheritsBased
Operations
Operations.aspxMicrosoft.SharePoint.ApplicationPages.OperationsLandingPageGlobalAdminPageBase
FarmServers.aspxMicrosoft.SharePoint.ApplicationPages.FarmServersPageOperationsPage : GlobalAdminPageBase
Server.aspxMicrosoft.SharePoint.ApplicationPages.ServerPageOperationsPage : GlobalAdminPageBase
GlobalEmailConfig.aspxMicrosoft.SharePoint.ApplicationPages.GlobalEmailConfigPageOperationsPage : GlobalAdminPageBase
IncomingEmail.aspxMicrosoft.SharePoint.ApplicationPages.IncomingEmailPageOperationsPage : GlobalAdminPageBase
FarmCredentialManagement.aspxMicrosoft.SharePoint.ApplicationPages.FarmCredentialManagementPageOperationsPage : GlobalAdminPageBase
irmadmin.aspxMicrosoft.SharePoint.ApplicationPages.IrmGlobalSettingsOperationsPage : GlobalAdminPageBase
avadmin.aspxMicrosoft.SharePoint.ApplicationPages.AntiVirusConfigPageOperationsPage : GlobalAdminPageBase
BlockedFileType.aspxMicrosoft.SharePoint.ApplicationPages.BlockedFileTypePageOperationsPage : GlobalAdminPageBase
policyfeatures.aspxMicrosoft.Office.RecordsManagement.InformationPolicy. ApplicationPages.PolicyFeatures (Microsoft.Office.Policy.AdminPages.dll)GlobalAdminPageBase
managesso.aspxMicrosoft.SharePoint.Portal.SingleSignonAdministration.ManageSSOPage (Microsoft.SharePoint.Portal.dll)SSOAdminBase : OfficeServerPageBase
metrics.aspxMicrosoft.SharePoint.ApplicationPages.MetricsPageOperationsPage : GlobalAdminPageBase
LogUsage.aspxMicrosoft.SharePoint.ApplicationPages.LogUsagePageOperationsPage : GlobalAdminPageBase
policyRptConfig.aspxMicrosoft.Office.RecordsManagement.Reporting. ApplicationPages.PolicyRptConfig (Microsoft.Office.Policy.AdminPages.dll)GlobalAdminPageBase
CMSMigration.aspxMicrosoft.SharePoint.Publishing.Internal.CodeBehind.ManageMigrationProfile (Microsoft.Sharepoint.Publishing.dll)Microsoft.SharePoint.WebControls. UnsecuredLayoutsPageBase
SkuUpgrade.aspxMicrosoft.SharePoint.Portal.ServerAdmin.SkuUpgradePage(Microsoft.SharePoint.Portal.dll)CentralAdminPageBase
EnableFeatures.aspxMicrosoft.SharePoint.Portal.ServerAdmin.FeaturePushdownPage (Microsoft.SharePoint.Portal.dll)CentralAdminPageBase
Conversion.aspxMicrosoft.Office.Server.Internal.UI.ConversionPageCentralAdminPageBase
ServiceRunningJobs.aspxMicrosoft.SharePoint.ApplicationPages.TimerJobsPageOperationsPage : GlobalAdminPageBase
ServiceJobDefinitions.aspxMicrosoft.SharePoint.ApplicationPages.TimerJobsPageOperationsPage : GlobalAdminPageBase
sitedirectorysettings.aspxMicrosoft.SharePoint.Portal.ServerAdmin.SiteDirectorySettings (Microsoft.SharePoint.Portal.dll)CentralAdminPageBase
linkscheckerjobsettings.aspxMicrosoft.SharePoint.Portal.SiteAdmin.LinksCheckerJobSettings (Microsoft.SharePoint.Portal.dll)CentralAdminPageBase
AlternateUrlCollections.aspxMicrosoft.SharePoint.ApplicationPages.AlternateUrlCollectionsPageGlobalAdminPageBase
ManageFarmFeatures.aspxMicrosoft.SharePoint.ApplicationPages.ManageFarmFeaturesPageApplicationsManagementPage : GlobalAdminPageBase
QuiesceFarm.aspxMicrosoft.Office.Server.Internal.UI.QuiesceFarmPageCentralAdminPageBase
Solutions.aspxMicrosoft.SharePoint.ApplicationPages.OperationsPageGlobalAdminPageBase
backup.aspxMicrosoft.SharePoint.ApplicationPages.BackupPageBackupAdminPageBase : OperationsPage : GlobalAdminPageBase
backuphistory.aspxMicrosoft.SharePoint.ApplicationPages.BackupHistoryPageBackupAdminPageBase : OperationsPage : GlobalAdminPageBase
restorestep1.aspxMicrosoft.SharePoint.ApplicationPages.RestoreStep1PageBackupAdminPageBase : OperationsPage : GlobalAdminPageBase
Restorestep3.aspxMicrosoft.SharePoint.ApplicationPages.RestoreStep3PageBackupAdminPageBase : OperationsPage : GlobalAdminPageBase
backupstatus.aspxMicrosoft.SharePoint.ApplicationPages.BackupStatusPageBackupAdminPageBase : OperationsPage : GlobalAdminPageBase
defaultcontentdb.aspxMicrosoft.SharePoint.ApplicationPages.DefaultContentDatabasePageOperationsPage : GlobalAdminPageBase
DspSettings.aspxMicrosoft.SharePoint.ApplicationPages.DspSettingsOperationsPage : GlobalAdminPageBase
Deployment.aspxMicrosoft.SharePoint.Publishing.Internal.CodeBehind. DeployManagePathsAndJobsPage (Microsoft.Sharepoint.Publishing.dll)BasePublishingPage : LayoutsPageBase : UnsecuredLayoutsPageBase
DeploymentSettings.aspxMicrosoft.SharePoint.Publishing.Internal.CodeBehind.DeploySettingsPage (Microsoft.Sharepoint.Publishing.dll)BasePublishingPage : LayoutsPageBase : UnsecuredLayoutsPageBase
DeploymentStatus.aspxMicrosoft.SharePoint.Publishing.Internal. CodeBehind.DeploymentObjectStatusPage (Microsoft.Sharepoint.Publishing.dll)BasePublishingPage : LayoutsPageBase : UnsecuredLayoutsPageBase
Application Management
applications.aspxMicrosoft.SharePoint.ApplicationPages.ApplicationsPageGlobalAdminPageBase
extendvsoption.aspxMicrosoft.SharePoint.ApplicationPages.ExtendVsOptionPageGlobalAdminPageBase
unextendvs.aspxMicrosoft.SharePoint.ApplicationPages.UnextendVirtualServerPageApplicationsManagementPage : GlobalAdminPageBase
deletewebapplication.aspxMicrosoft.SharePoint.ApplicationPages.DeleteWebApplicationPageApplicationsManagementPage : GlobalAdminPageBase
scprefix.aspxMicrosoft.SharePoint.ApplicationPages.SscPrefixPageApplicationsManagementPage : GlobalAdminPageBase
vsemail.aspxMicrosoft.SharePoint.ApplicationPages.VSEmailConfigPageApplicationsManagementPage : GlobalAdminPageBase
vsgeneralsettings.aspxMicrosoft.SharePoint.ApplicationPages.VirtualServerGeneralSettingsPageApplicationsManagementPage : GlobalAdminPageBase
cntdbadm.aspxMicrosoft.SharePoint.ApplicationPages.ContentDBManagmentPageApplicationsManagementPage : GlobalAdminPageBase
ManageWebAppFeatures.aspxMicrosoft.SharePoint.ApplicationPages.ManageWebAppFeaturesPageApplicationsManagementPage : GlobalAdminPageBase
WebApplications.aspxMicrosoft.SharePoint.ApplicationPages.ListWebApplicationsPageSelectWebApplicationPage : SelectPage : GlobalAdminPageBase
managessp.aspxMicrosoft.Office.Server.Internal.UI.ManageSspPageCentralAdminPageBase
manageinterfarmservices.aspxMicrosoft.Office.Server.Internal.UI.ManageInterFarmServicesPageCentralAdminPageBase
checkfarmservices.aspxMicrosoft.Office.Server.Internal.UI.CheckFarmServicesPageCentralAdminPageBase
SessionStateAdmin.aspxMicrosoft.Office.Server.Internal.UI.SessionStateAdminPageCentralAdminPageBase
SPSecuritySettings.aspxMicrosoft.SharePoint.ApplicationPages.WebPartPageSettingsPageApplicationsManagementPage : GlobalAdminPageBase
configssc.aspxMicrosoft.SharePoint.ApplicationPages.ConfigSscPageApplicationsManagementPage : GlobalAdminPageBase
vsmask.aspxMicrosoft.SharePoint.ApplicationPages.VirtualServerMaskPageApplicationsManagementPage : GlobalAdminPageBase
policy.aspxMicrosoft.SharePoint.ApplicationPages.PolicyPageApplicationsManagementPage : GlobalAdminPageBase
AuthenticationProviders.aspxMicrosoft.SharePoint.ApplicationPages.GlobalAdminPageBase
managesearchservice.aspxMicrosoft.SharePoint.Portal.Search.Admin.Pages.ManageSearchService (Microsoft.SharePoint.Portal.dll)SearchCentralAdminPageBase : CentralAdminPageBase
workflowadmin.aspxMicrosoft.SharePoint.ApplicationPages.WorkflowAdminPageApplicationsManagementPage : GlobalAdminPageBase
createsite.aspxMicrosoft.SharePoint.ApplicationPages.CreateSitePageApplicationsManagementPage : GlobalAdminPageBase
delsite.aspxMicrosoft.SharePoint.ApplicationPages.DeleteSitePageApplicationsManagementPage : GlobalAdminPageBase
DeleteSiteConfig.aspxMicrosoft.SharePoint.ApplicationPages.DeleteSiteConfigApplicationsManagementPage : GlobalAdminPageBase
ManageQuotaTemplate.aspxMicrosoft.SharePoint.ApplicationPages.ManageQuotaTemplatePageApplicationsManagementPage : GlobalAdminPageBase
SiteQuota.aspxMicrosoft.SharePoint.ApplicationPages.SiteQuotaPageApplicationsManagementPage : GlobalAdminPageBase
owners.aspxMicrosoft.SharePoint.ApplicationPages.OwnersPageApplicationsManagementPage : GlobalAdminPageBase
SiteCollections.aspxMicrosoft.SharePoint.ApplicationPages.ListSitesPageSelectSitePage : SelectPage : GlobalAdminPageBase
OfficialFileAdmin.aspxMicrosoft.SharePoint.ApplicationPages.OfficialFileAdminPageApplicationsManagementPage : GlobalAdminPageBase
HtmlTransAdmin.aspxMicrosoft.SharePoint.ApplicationPages.HtmlTransAdminPageApplicationsManagementPage : GlobalAdminPageBase
DocTransAdmin.aspxMicrosoft.SharePoint.ApplicationPages.DocTransAdminPageApplicationsManagementPage : GlobalAdminPageBase
ManageFormTemplates.aspxMicrosoft.Office.InfoPath.Server. ApplicationPages.ManageFormTemplatesPage (Microsoft.Office.InfoPath.Server.Pages.dll)GridViewPageBase : AdminPageBase
ipfsConfig.aspxMicrosoft.Office.InfoPath.Server. ApplicationPages.FormServerConfigPage (Microsoft.Office.InfoPath.Server.dll)AdminPageBase
UploadFormTemplate.aspxMicrosoft.Office.InfoPath.Server. ApplicationPages.UploadFormTemplatePage (Microsoft.Office.InfoPath.Server.dll)AdminPageBase
ManageDataConnectionFiles.aspxMicrosoft.Office.InfoPath.Server. ApplicationPages.ManageDataConnectionFilesPage (Microsoft.Office.InfoPath.Server.Pages.dll)GridViewPageBase : AdminPageBase
ManageFormsServiceProxy.aspxMicrosoft.Office.InfoPath.Server. ApplicationPages.ManageFormsServiceProxyPage (Microsoft.Office.InfoPath.Server.Pages.dll)AdminPageBase
Shared Services Administration
managessp.aspxMicrosoft.Office.Server.Internal.UI.ManageSspPageCentralAdminPageBase

Building minimal SharePoint Central Administration Application Page.

Typical Central Admin Application Page inherits from Microsoft.SharePoint.ApplicationPages.GlobalAdminPageBase.
In order to be consistent with current pages we want to inherit the new:
• Operations Section page – from Microsoft.SharePoint.ApplicationPages.OperationsPage;
• Application Management page – from Microsoft.SharePoint.ApplicationPages.ApplicationsManagementPage;
Both OperationsPage and ApplicationsManagementPage classes overrides just one PageToRedirectOnCancel property from GlobalAdminPageBase.

Let’s build our first blank Central Admin Applications Management page:
Here is the code:
using System;
using System.Web;

namespace Sharepointalist.Samples.CentralAdmin
{
    public class ApplicationManagementSamplePage : Microsoft.SharePoint.ApplicationPages.ApplicationsManagementPage
    {

    }
}
Here is the web page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationManagementSamplePage.aspx.cs" Inherits="Sharepointalist.Samples.CentralAdmin.ApplicationManagementSamplePage, Sharepointalist.Samples.CentralAdmin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f18faed9b7b4caf" MasterPageFile="~/_admin/admin.master"%>

<asp:Content ID="Content1" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>

<asp:Content ID="Content2" contentplaceholderid="PlaceHolderPageTitle" runat="server">
</asp:Content>

<asp:Content ID="Content3" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
</asp:Content>

<asp:content ID="Content4" contentplaceholderid="PlaceHolderPageDescription" runat="server">
</asp:content>

<asp:content ID="Content5" contentplaceholderid="PlaceHolderMain" runat="server">
</asp:content>

Deployment.

The best way to deploy Central Administration Application Pages is to create a feature. This is described numerous times, so I am not going to get deep this. Just don't forget:

In many cases we want to add a new link to our new page on the MOSS Central Administration Site. We can use Element Manifest file with CustomAction defined for that. Please refer to Custom Action Definitions and Default Custom Action Locations and IDs on MSDN for detailed info.
In short, we need to choose Location(Page) and select/create a Group for our link.
Possible Locations and Groups:
  • Operations Page - Microsoft.SharePoint.Administration.Operations.
    • Backup and Restore - BackupRestore;
    • Data Configuration - DataConfiguration;
    • Global Configuration - GlobalConfiguration;
    • Logging and Reporting - LoggingAndReporting;
    • Security Configuration - Security;
    • Topology and Services - Topology;
    • Upgrade and Migration - Upgrade;
    • Content Deployment - ContentDeployment;
  • Application Management Page - Microsoft.SharePoint.Administration.ApplicationManagement.
    • Application Security - ApplicationSecurity;
    • External Service Connections - ExternalService;
    • SharePoint Site Management - SiteManagement;
    • SharePoint Web Application Management - WebApplicationConfiguration;
    • Workflow Management - WorkflowManagement;
    • Search - SearchGroup;
    • InfoPath Forms Services - IPFSApplicationConfiguration;
    • Office SharePoint Server Shared Services - OfficeServerCoreServices;
  • Application Created Page - Microsoft.SharePoint.Administration.ApplicationCreated.
    • Links - Links;
  • Shared Services Administration Page - Office.Server.ServiceProvider.Administration.
    • User Profiles and My Sites - UAP;
    • Search - Search;
    • Excel Services Settings - ExcelServer;
    • Audiences - AUD;
    • Office SharePoint Usage Reporting - PortalAnalytics;
    • Business Data Catalog - BDC;

Here is a sample Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomActionGroup
    Id="Sharepointalist.Samples.CentralAdmin.ApplicationManagementGroup"
    Location="Microsoft.SharePoint.Administration.ApplicationManagement"
    Title="Sharepointalist"
    Sequence="10" />
  <CustomAction 
    Id="Sharepointalist.Samples.CentralAdmin.ApplicationManagementSamplePage"
    GroupId="Sharepointalist.Samples.CentralAdmin.ApplicationManagementGroup"
    Title="Application Management Sample Page"
    Sequence="1"
    Location="Microsoft.SharePoint.Administration.ApplicationManagement">
    <UrlAction Url="/_admin/Sharepointalist/Samples/ApplicationManagementSamplePage.aspx"/>
  </CustomAction>
</Elements>

Here is a sample Feature.xml
<?xml version="1.0" encoding="utf-8" ?>
<Feature  Id="90AC28E1-F64B-42bb-AB51-C65590ED5CD4"
          Title="Sharepointalist Sample Central Administration Feature"
          Description="Sample Central Administration Feature. Please visit my web page at http://www.sharepointalist.com/"
          Version="1.0.0.0"
          Creator="http://www.sharepointalist.com/"
          ActivateOnDefault="True"
          Scope="Farm"
          xmlns="http://schemas.microsoft.com/sharepoint/"
          ReceiverAssembly="Sharepointalist.Samples.CentralAdmin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f18faed9b7b4caf"
          ReceiverClass="Sharepointalist.Samples.CentralAdmin.FeatureHandler">
  <Properties>
    <Property Key="GloballyAvailable" Value="true" />
  </Properties>
  <ElementManifests>
    <ElementManifest Location="Elements.xml"/>
  </ElementManifests>
</Feature>

Summary

This is enough to create a blank page. You can download an archive with the source code and deployment package here.