Wednesday, January 14, 2009

The Microsoft SharePoint Theme Definition Xml Bug

Blowing snow outside and even can not to see the faced person. Keep dig out my second version of custom theme.

The bug description: you can not define the TemplateID of 12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML with the same first 8 letters naming or it will show you error of "A theme with the name "XXXX" and version already exists on the server".

I met such error when I create my second version of one custom theme.




10 steps to create custom field control by STSDEV




Basically, the field control is a easy implement to deploy.
There's a Field Control template within SharePoint template when you create by VS 2008.
Usually, best bet is create one by VS SharePoint template and test it out then pack by STSDEV and deploy. Here is the 10 main steps:





  1. VS 2008 - Tools - STSDEV (need configured first), create a STSDEV solution by solution type: Empty solution (C# assembly), don't forget to create a correlative key.


  2. Open the C# solution and add a new SharePoint Empty project by this solution.


  3. Add a new Field Control into the SharePoint project.


  4. Create a XXXXFieldRending.ascx file to TEMPLATE\CONTROLTEMPLATES\XXXXFieldRending.ascx
    Here is the example code:

    <%@ Control Language="C#" Debug="true"%>
    <%@ Assembly Name="Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.WebControls"%>

    <SharePoint:RenderingTemplate ID="KBIDFieldRendering" runat="server">
    <Template>
    <table class="ms-form">
    <tr>
    <td>
    <asp:Literal ID="Desc_Category" runat="server"></asp:Literal>
    <asp:Literal ID="Category" runat="server"></asp:Literal>
    <asp:Literal ID="Desc_KBID" runat="server"></asp:Literal>
    <asp:Literal ID="KBID" runat="server"></asp:Literal>
    </td>
    </tr>
    </table>
    </Template>
    </SharePoint:RenderingTemplate>



  5. Open TEMPLATE\XML\fldtypes_XXXX.xml, get assembly string and put in Field Name="FieldTypeClass", RenderPattern Name="DisplayPattern" can be finally put and test.


  6. Update and overwrite the XXXX\XXXX.FieldControl.cs


  7. Debugging and compiling SharePoint project to test working fine. (Need copy ascx, xml and dll file to correct system folders and then iisreset)


  8. Drag folder XXXX and TEMPLATE into the STSDEV project, XXXX within project root, TEMPLATE is supposed to put in Rootfiles\


  9. Debug and compile the STSDEV project at DebugBuild mode.


  10. Change mode to DebugDeploy and build STSDEV project for deploy to MOSS site. You will see the correct field type when you create a new column in site.


Wednesday, December 24, 2008

How to delete master page from Master Page Gallery

As title description, you will find the window pops up the error message as following:
This item cannot be deleted because it is still referenced by other pages.
The delete method:
  1. Open Site Action-Master Page Gallery, click New -Folder to create a new temp folder.
  2. Open the site by SharePoint Designer, click left tree menu to open _catalogs\masterpage, and drag the master file into the temp folder.
  3. Back to IE-Master Page Gallery and press F5 to refresh and then dropdown the temp folder and click [Delete].
  4. Back SharePoint Designer and press [Delete] button to delete the temp folder and press F5 to refresh.

Wednesday, December 17, 2008

Update the Theme CSS immediately.

Once you are doing change css for a page redering to see, you will find it doesn't work immediately if you change something in theme.css or mossExtension.css.

The way to make it works is doing iisreset, it's a permanent change.
You can use SharePoint Designer to open another temporary file named like Xxxx1011-65001.css which is merged by both of theme.css and mossExtension.css. This file is under _themes\yourthemefolder.

It will be available immediately.

RegistrationId List Template Type IDs

RegistrationId List Template Type IDs
InvalidType = -1
GenericList = 100
DocumentLibrary = 101
Survey = 102Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
DataSources = 110
WebTemplateCatalog = 111
UserInformation = 112
WebPartCatalog = 113
ListTemplateCatalog = 114
XMLForm = 115 (InfoPath Forms Library)
MasterPageCatalog = 116
NoCodeWorkflows = 117
WorkflowProcess = 118
WebPageLibrary = 119
CustomGrid = 120
DataConnectionLibrary = 130
WorkflowHistory = 140
GanttTasks = 150
Meetings = 200
Agenda = 201
MeetingUser = 202
Decision = 204
MeetingObjective = 207
TextBox = 210
ThingsToBring = 211
HomePageLibrary = 212
Posts = 301
Comments = 302
Categories = 303
Pages = 850
IssueTracking = 1100
AdminTasks = 1200
Translation Management Library = 1300
Languages & Translations = 1301

Monday, December 8, 2008

How to remove the site theme from site settings

After you deployed custom theme by STSDEV and then retract and delete the solution.

You will find it will still exist on site settings-site theme (http://mysharepoint/_layouts/themeweb.aspx)

To remove it, open the file C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML , find the corresponding templates and delete it.

You will see it disappear from the theme management after iisreset.

STSDEV with Theme function error handle

When you first time to create a solution for theme definition by STSDEV theme version. You might be see the error message when do a deployment as following:
The 'ReceiverAssembly' attribute is invalid.

The steps to fix this issue:

  1. Install Reflector and running it. ( If there's not already, you are going to download it from http://www.red-gate.com/products/reflector/)
  2. Run reflector and open the directory which host solution dll file. (Your solution folder\bin\Debug) And drag the dll into the reflector panel and then click the new added one.
  3. Copy the name string from bottle panel of reflector and paste into "ReceiveAssembly item" of file feature.xml.