Monday, November 15, 2010

SharePoint EditControlBlock RegistrationId types

public enum SPListTemplateType
{
InvalidType = -1,
GenericList = 100,
DocumentLibrary = 101,
Survey = 102,
Links = 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,
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,
IssueTracking = 1100,
AdminTasks = 1200,
}

Thursday, November 11, 2010

SharePoint 2010 Backward Compatible Document Library Events

They still work. Hooray!!

When I go to the SharePoint 2010 document library settings I can see:

Specify the assembly name, class name and properties for the document library's event handler. WSS_LONG_NAME will call this event handler when items in the document library are inserted, updated, or deleted.

Not sure what "WSS_LONG_NAME" is but apparently it will call my SharePoint 2010 document library event handler.

To enable this to show, I went to Central Admin of my SharePoint 2010 farm, Manage Web Applications, select the web application and then click on Resource Throttling. There will be a radio button to turn this (backward compatible document library events) on or off.

Tuesday, November 9, 2010

SharePoint 2010 Common Navigation Across Site Collections

So Microsoft best practice dictates content dbs should be less than 100GB or so, at least that's what I think. Either way, you're here because you have multiple site collections and want to know how to have the same top navigation bar across all the site collections. It took me a few hours to find but here's the solution.

In web.config file, add the following provider


<siteMap defaultProvider="CurrentNavigation" enabled="true">

<providers>

<add name="CustomTopNavProvider" siteMapFile="/_layouts/1033/CustomTopNavMenu.sitemap" type="System.Web.XmlSiteMapProvider,System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>





Add the CustomTopNavMenu.sitemap to the 1033 directory. If you don't know how to create or use a sitemap file just google it.

Open up the master page for each site collection, for 2010 it's v4, probably best to create a copy and all that stuff before editing it.

Find this part of the file. (around line 343)




<SharePoint:AspMenu

  ID="TopNavigationMenuV4"

  Runat="server"

  EnableViewState="false"

  DataSourceID="topSiteMap"

  AccessKey="<%$Resources:wss,navigation_accesskey%>"

  UseSimpleRendering="true"

  UseSeparateCss="false"

  Orientation="Horizontal"

  StaticDisplayLevels="2"

  MaximumDynamicDisplayLevels="1"

  SkipLinkText=""

  CssClass="s4-tn"/>

<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">

<Template_Controls>

<asp:SiteMapDataSource

  ShowStartingNode="False"

  SiteMapProvider="SPNavigationProvider"

  id="topSiteMap"

  runat="server"

  StartingNodeUrl="sid:1002"/>

</Template_Controls>

</SharePoint:DelegateControl>





and change it to the following:


<SharePoint:AspMenu

  ID="TopNavigationMenuV4"

  Runat="server"

  EnableViewState="false"

  DataSourceID="topSiteMap"

  AccessKey="<%$Resources:wss,navigation_accesskey%>"

  UseSimpleRendering="true"

  UseSeparateCss="false"

  Orientation="Horizontal"

  StaticDisplayLevels="1"

  MaximumDynamicDisplayLevels="4"

  SkipLinkText=""

  CssClass="s4-tn"/>

<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource">

<Template_Controls>

<asp:SiteMapDataSource

  ShowStartingNode="False"

  SiteMapProvider="CustomTopNavProvider"

  id="topSiteMap"

  runat="server"

/>

</Template_Controls>

</SharePoint:DelegateControl>





basically we are setting the SiteMapProvider to the provider we added in the web.config that reads our custom site map file. We don't show the starting node, we remove an ID of the DelegateControl (may or may not be necessary) and then set the StaticDisplayLevels of the ASPMenu to 1 and the MaximumDynamicDisplayLevels to 4. S

Save masterpage, reload page and whamooo, it should work. If not, leave a comment and I'll try to help.

Expanding on this, if you created a web part that could read and update the sitemap file, then users would not necessarily need access to the 1033 folder to update navigation.

UPDATE: after some research, it doesn't seem possible to dynamically update the .sitemap file using a web part. I suggest putting a custom folder in the 1033 folder for navigation and share it out to those who need to be able to update it. It will need to be update on all front end web servers.