Strange Error on Web Frontend Server of MOSS 2007 farm: stsadm operation “enumallwebs” with “includewebparts” options results in lots of missing WebParts

During a migration project from MOSS 2007 to SharePoint 2010 we got a strange error that took some hours to resolve.

For an automated migration tasks I tried to create a PowerShell script to enumerate all WebParts on all ASPX pages using SPLimitedWebPartManager on a WFE of the MOSS 2007 farm. But I only got “ErrorWebPart” for every WebPart on the Web Application!

Then I used “stsadm” to enumerate all WebParts:

stsadm –o enumallwebs –databasename sharepoint_content_local_sharepoint_local –includewebparts > allwebparts.txt

This is the result:

<Databases>
  <Database SiteCount="2" Name="sharepoint_content_local_sharepoint_local" DataSource="server">
    <Site Id="12345678-716d-44a3-a973-fffffffffff" OwnerLogin="domainspadmin" InSiteMap="True">
      <Webs Count="5">
        <Web Id="12345678-17d9-4870-8d94-fffffffffff" Url="/sites/test1" LanguageId="1031" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="00f5bad9-f117-4eca-8d77-194bb598d7c6" Count="1" Status="Missing" />
            <WebPart Id="e398c8f4-1750-b857-cca9-2542cadaee8f" Count="1" Status="Missing" />
            <WebPart Id="d23f666e-372e-8f7d-e9f4-341c7fab5653" Count="1" Status="Missing" />
            <WebPart Id="9f7a9f30-76a0-2d43-0d84-402ba6c3c125" Count="1" Status="Missing" />
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="e60f6c95-e86c-4717-2c0d-6d8563c9caf7" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="103" Status="Missing" />
            <WebPart Id="6bbb6e7d-fe0d-5d79-6c79-76a90de47e1c" Count="1" Status="Missing" />
            <WebPart Id="9f030319-fa14-b625-4892-89f6f9f9d58b" Count="1" Status="Missing" />
            <WebPart Id="b9a7f972-708a-cd77-4ffd-a235dfed5c38" Count="1" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="182" Status="Missing" />
            <WebPart Id="db128878-9a93-4768-2256-cc2c390ffb57" Count="1" Status="Missing" />
          </WebParts>
        </Web>
        <Web Id="12345678-3bda-4109-aacd-fffffffffff" Url="/sites/test1/subweb1" LanguageId="1031" TemplateName="STS#1" TemplateId="1">
          <WebParts>
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="9" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="7" Status="Missing" />
          </WebParts>
        </Web>
        <Web Id="12345678-b479-4157-91e5-fffffffffff" Url="/sites/test1/subweb2" LanguageId="1031" TemplateName="STS#1" TemplateId="1">
          <WebParts>
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="6" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="5" Status="Missing" />
          </WebParts>
        </Web>
        <Web Id="12345678-25f3-450f-b44d-fffffffffff" Url="/sites/test1/subweb3" LanguageId="1031" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="21" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="22" Status="Missing" />
          </WebParts>
        </Web>
        <Web Id="12345678-b341-4370-b0c6-fffffffffff" Url="/sites/test1/subweb4" LanguageId="1031" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="e60f6c95-e86c-4717-2c0d-6d8563c9caf7" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="23" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="27" Status="Missing" />
          </WebParts>
        </Web>
      </Webs>
    </Site>
    <Site Id="12345678-730c-46fd-a114-fffffffffff" OwnerLogin="domainspadmin" InSiteMap="True">
      <Webs Count="2">
        <Web Id="12345678-7cd6-447d-8107-fffffffffff" Url="/sites/test2" LanguageId="1031" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="d55b3b6b-6281-707b-73d0-0c49581475ad" Count="1" Status="Missing" />
            <WebPart Id="aadc2962-fc63-03e2-f119-13e7096bab20" Count="1" Status="Missing" />
            <WebPart Id="2f1510c7-75d5-921f-b120-2ce98fe3afe3" Count="1" Status="Missing" />
            <WebPart Id="f5c3ff60-e752-3a90-84f8-3677f8384e2d" Count="2" Status="Missing" />
            <WebPart Id="f2c50a02-9894-4ace-bb3f-4146a24cd940" Count="2" Status="Missing" />
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="2" Status="Missing" />
            <WebPart Id="e60f6c95-e86c-4717-2c0d-6d8563c9caf7" Count="2" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="83" Status="Missing" />
            <WebPart Id="9f030319-fa14-b625-4892-89f6f9f9d58b" Count="1" Status="Missing" />
            <WebPart Id="c9b34b5d-bf06-dc91-d23e-94ecad31cd0a" Count="2" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="83" Status="Missing" />
            <WebPart Id="74bd016c-baa0-14a8-d5d8-b75dc7e6f429" Count="1" Status="Missing" />
            <WebPart Id="94e9c166-264a-f84b-2377-bccefb8b3771" Count="1" Status="Missing" />
            <WebPart Id="fb35a198-aea0-3c26-e40c-df473fe9b07b" Count="2" Status="Missing" />
            <WebPart Id="669602d9-e116-ccb8-eea3-e37ad589b14b" Count="1" Status="Missing" />
            <WebPart Id="f5897322-ddd4-c990-d012-f9d4fe2180ad" Count="2" Status="Missing" />
          </WebParts>
        </Web>
        <Web Id="12345678-80e5-425d-b0d9-fffffffffff" Url="/sites/test4" LanguageId="1031" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Missing" />
            <WebPart Id="e60f6c95-e86c-4717-2c0d-6d8563c9caf7" Count="1" Status="Missing" />
            <WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="81" Status="Missing" />
            <WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="105" Status="Missing" />
          </WebParts>
        </Web>
      </Webs>
    </Site>
  </Database>
</Databases>

(This file is modified: I’ve changed Web and Site IDs and I’ve removed lots of webs and sites.)

EVERY WEBPART IS MISSING!! Also all default MOSS 2007 WebParts with default SharePoint DLLs!

BUT… On the second Web Frontend Server all WebParts are Status=”Installed” !!! Strange…

In the events viewer we found:

clip_image002

image

It’s a SharePoint Feature DLL that is missing!

This error is not present on the second WFE!

So we installed the missing DLL in the GAC.

And… now it works! – All WebParts have status “Installed” in the stsadm output!

Summary

The feature deployment on the WFE was not successfull. There must be an error but MOSS 2007 doesn’t tell us about it. All solutions seems to be deployed in the Solution Management of the farm…

Deploying “Fantastic Fourty“ templates of MOSS 2007 on SharePoint 2010

There are the “Fantastic Fourty” templates you all now… They are create for MOSS 2007 and there are no update available for SharePoint 2010… Because of a migration of MOSS 2007 to SharePoint 2010 I need to deploy some of the site definitions to SharePoint 2010 to get the “old” sites working…

Do you know you can publish the Fantastic-40 on SharePoint 2010? – Here is a nice article about that: http://marijnsomers.blogspot.com/2010/06/fantastic-40-templates-on-sharepoint.html

On this page you’ll find updates solution packages: http://techsolutions.net/Blog/tabid/65/EntryId/17/Fab-40-Templates-for-MOSS-2010.aspx

 

BUT…

After deployment of the base solution “ApplicationTemplateCore.wsp” this is what I liked to do:

1. Create a Site Collection

image

2. Enter some data and choose the “Custom” category for the site template. Click “Select template later”…

SNAGHTMLc2b02f

3. Now create the site and open them. You get:

image

4. Now open the “Site Settings” from the “Site Actions” menu.

5. Click “Site Collection Features”.

6. Try to activate feature “Fields and Content Types for the Windows SharePoint Services Application Templates”

image

7. You get:

image

 

But as I tried to deploy and activate them I got this error:

  

Server Error in '/' Application.
--------------------------------------------------------------------------------

The field with Id {46b00cd2-bc51-45d8-87e1-68f1be35275f} defined in feature {75a0fea7-cd50-401e-af0e-782f3662a299} was found in the current site collection or in a subsite. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.SharePoint.SPException: The field with Id {46b00cd2-bc51-45d8-87e1-68f1be35275f} defined in feature {75a0fea7-cd50-401e-af0e-782f3662a299} was found in the current site collection or in a subsite.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

 

Stack Trace:

[SPException: The field with Id {46b00cd2-bc51-45d8-87e1-68f1be35275f} defined in feature {75a0fea7-cd50-401e-af0e-782f3662a299} was found in the current site collection or in a subsite.]

   Microsoft.SharePoint.Utilities.SPUtility.ThrowSPExceptionWithTraceTag(UInt32 tagId, ULSCat traceCategory, String resourceId, Object[] resourceArgs) +27772295   

Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce) +23652209   

Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) +138   

Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce) +25437423   

Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly) +27496895   

Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, String featureName, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope) +150   

Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId, Boolean force, SPFeatureDefinitionScope featdefScope) +83   

Microsoft.SharePoint.WebControls.FeatureActivator.ActivateFeature(Guid featid, SPFeatureDefinitionScope featdefScope) +699   

Microsoft.SharePoint.WebControls.FeatureActivatorItem.BtnActivateFeature_Click(Object objSender, EventArgs evtargs) +140   

System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140   

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

 

Okay… This is the solution that I’ve developed some minutes ago.

1. You need to decompress the “ApplicationTemplateCore.WSP” file. – It’s nothing else than a CAB file renamed to WSP. – Use 7zip to decompress it.

2. Open the file <fantastic40-folder>ApplicationTemplateCoreTSATypesFields.xml. Search for 46b00cd2-bc51-45d8-87e1-68f1be35275f and remove one of the double entries of this field definition:

SNAGHTML5a2ab1a

image

(Remove the code in the red frame.)

3. By the way: This is not the only bug in the WSP file. But for now we go ahead… We need to recreate the WSP file.

This is not easy.

a) First download “DDFGenerator.exe” from http://ddfgenerator.codeplex.com/

b) Open a command line prompt.

c) Type the path to “DDFGenerator.exe” and specify the path of the WSP content as parameter.

image

d) In the WSP content folder you’ll find a file named “solution.ddf”. Edit this file in Notepad. Insert “.Set CabinetNameTemplate=ApplicationTemplateCore.WSP” as 5th line. – Save and close the file.

image

e) Go into the folder and execute “MakeCab.exe /F solution.ddf”

SNAGHTMLda5e2a

Now you have a new WSP file in a sub folder of the WSP content folder.

image

4. Now run a solution upgrade.

5. Try to activate the feature again. You get another error:

image

The field with Id {26118c12-ea11-48ae-950b-a7219a9738f8} defined in feature {75a0fea7-cd50-401e-af0e-782f3662a299} was found in the current site collection or in a subsite. 

6. If your search for GUID “26118c12-ea11-48ae-950b-a7219a9738f8” you’ll find another field that is deployed twice:

<Field ID="{26118C12-EA11-48ae-950B-A7219A9738F8}" Name="TextFileName" DisplayName="$Resources:core,Name;" Type="Text" Group="_Hidden" Sealed="TRUE" AllowDeletion="FALSE"></Field>

…in file <fantastic40-folder>ApplicationTemplateCoreTSATypesFields.xml

Here you need to delete one of the entries…

7. The next try also results in an error:

image

The field with Id {ebb85cf8-047c-4ba7-9fd6-01bfa5ef126d} defined in feature {75a0fea7-cd50-401e-af0e-782f3662a299} was found in the current site collection or in a subsite.

8. Search for GUID “ebb85cf8-047c-4ba7-9fd6-01bfa5ef126d”. – Here it’s more complexe to resolve this issue. Because there are to diffrent fields with the same ID!

image

(It’s file <fantastic40-folder>ApplicationTemplateCoreTSATypesFields.xml again!)

You need to create a new ID for one of the field.

I’ve choosen “93B5756C-727F-4C4B-A081-E8654A234739” as new ID for field “AssetPurchasePrice”. You can use this GUID too!

Now you need to change every reference to field “AssetPurchasePrice” in all files of the project. Here is a list of files:

  • <fantastic40-folder>ApplicationTemplateCoreTSATypesFields.xml
  • <fantastic40-folder>ApplicationTemplateCoreTSATypesCTypes.xml
  • <fantastic40-folder>ApplicationTemplateCoreLendingLibraryListAssetsschema.xml
  • <fantastic40-folder>ApplicationTemplateCoreInventoryTrackingInventoryListInventoryschema.xml
  • <fantastic40-folder>ApplicationTemplateCoreAssetTrackingProposalsListProposalsschema.xml
  • <fantastic40-folder>ApplicationTemplateCoreAssetTrackingAssetsListAssetsschema.xml

Be sure to replace the ID of all references of “AssetPurchasePrice” with the new ID! Don’t touch the references of the other field “AssetDateRetired” with the same ID. Do not use Search and Replace to replace the GUID.

A sample for file <fantastic40-folder>ApplicationTemplateCoreAssetTrackingAssetsListAssetsschema.xml after replacing the ID of “AssetPurchasePrice”:

image

(In the red box I’ve replaced the ID. In the green oval I’ve left the ID untouched!)

BTW: The GUID of “AssetDateRetired” is “EBB85CF8-047C-4ba7-9FD6-01BFA5EF126D”: There are lower case letters and upper case letters in the GUID. I think they are edited by hand by someone and that’s the reason of the error…

9. Save your work and repack the solution as described above and deploy the package to SharePoint.

10. Now I’m able to activate the feature “Fields and Content Types for the Windows SharePoint Services Application Templates”:

image

12. That’s it so far.

13. Now I’d like to use a Fantastic-40 template. In my case “Helpdesk”. I deployed the “Helpdesk.WSP” of the Fantastic-40 bundle to SharePoint 2010. – Without any error.

14. Click the homepage of your site and you’ll reach the “Template Picker” application page if you did not select a template for the site before like me.

image

15. Now I have a working “Helpdesk” site – as far as I can see.

image