Monday, March 26, 2007

You can use the following code snippet to iterate through your navigation tree recursive:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing.Navigation;

public class SiteMapTest : System.Web.UI.WebControls.WebParts.WebPart
{

   protected
override void RenderContents(System.Web.UI.HtmlTextWriter writer)
   {
      PortalSiteMapProvider map = new PortalSiteMapProvider();
      writer.Write("<table>");
      this.PrintTree(map.RootNode, writer, 0);
      writer.Write("</table>");
   }

   public
void PrintTree(SiteMapNode node, System.Web.UI.HtmlTextWriter writer, int level)
   {
      string space = string.Empty;
      for (int i = 0; i < level; i++)
      {
         space += "&nbsp;&nbsp;&nbsp"&nbsp;&nbsp;&nbsp";
      }
      writer.Write("<tr><td>" + space + "<a href=\"" + node.Url + "\">" + node.Title + "</a></tr></td>");
      foreach (SiteMapNode childNode in node.ChildNodes)
      {
         PrintTree(childNode, writer, level + 1);
      }
   }

}

If you use a SPSiteMapProvider instead of PortalSiteMapProvider, you will only see your sites, no pages.
SPContentMapProvider delivers nothing for me, there are no ChildNodes defined. I didn't check out SPNavigationProvider, but I had some bad expierence with Microsoft.SharePoint.Navigation.SPNavigation.
For some more informations see: http://msdn2.microsoft.com/en-us/library/aa830815.aspx#Office2007SSBrandingWCMPart2_CustomizingNavigation

3/26/2007 2:26:31 PM (Mitteleuropäische Sommerzeit , UTC+02:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, March 15, 2007

Visual Studio Integration

It would be very helpful if it would be possible to edit master pages and page layouts in VS2005.
It would be groundbreaking if you could run a little instance of MOSS 2007 on a local machine (e.g. in Cassini) to debug and develop your WebParts. This "little instance" should connect to your MOSS 2007 content database. I bet this will come with one of the next MOSS releases or service packs?!? (If I would be jobless I would implement this or a similar thing and make a lot of money)

Variations

Let's say you have three different page layouts and only one content type (all page layouts use the same content type). This makes sense because you are not sure which layout to use or you want to give your authors the possibility to switch between page layouts (what only works between page layouts with the same content type).
If you now create a variation of a page using one of these page layouts (or let MOSS created this variation automatically), SharePoint 2007 allocates the first page layout you created with the content type to your new page. This is wrong in 66% of all cases (for three page layouts), so you probably have to assign the right page layout by hand. Not funny in ECMS environments with more than one language variation. But we heard about this as a feature.

Separation Of Content And Structure

Separating content like images, text, etc from structure (navigation tree, site structure, master pages, page layouts, css, ...) would allow you to implement redesigns easier and to enable parallel work between developers and authors.
If you developed a large scale enterprise website with daily new content, and, on the other side, plan a redesign with seriously impact on the structure, you have no other possibility as implementing your redesign on one system (let's say staging environment) and to maintain your content on the other system (let's say authoring environment).
What you have to do now is to maintain your content on both systems (authoring and staging). This can be very hard. Another possibility would be to automatically deploy your content from authoring to staging, but this is no out of the box functionality and I'm sure it's not easy to implement.
Partially the separation seems to work if you are not provisioning publishing features and if you don't use SharePoint Designer. At least master pages are stored in the filesystem for that case.

Deployment with the integrated deployment path...

... should work (without re-setting master pages or breaking sites). Hope there will be a hotfix soon.

SharePoint Designer...

... should not freeze the whole system, double html headers or reformat your well formatted html code.

 

... to be continued.

3/15/2007 8:53:14 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, March 14, 2007

If you add inline code to your e.g. PageLayout in MOSS 2007 you will get the following error: "Code blocks are not allowed in this file".

To avoid this problem, add the following code block to your web.config:

<PageParserPaths>

  <PageParserPath VirtualPath="/" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

</PageParserPaths>

This will allow inline code in your entire site collection. Make sure to be aware with security issues and inline code. To enable inline code only for a single file use:

<PageParserPaths>

  <PageParserPath VirtualPath="/Pages/MyPage.aspx" CompilationMode="Always" AllowServerSideScript="true" />

</PageParserPaths>

3/14/2007 11:53:21 AM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, February 20, 2007

Example:
DataSet data = new DataSet();
SPWeb site = SPContext.Current.Site.OpenWeb("/SiteName");
SPList list = site.Lists["Listname"];
data.Tables.Add(list.Items.GetDataTable());

 

2/20/2007 1:19:34 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, February 05, 2007
  1. Navigate to "~Program Files~\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES" on your SharePoint 2007 Server
  2. Edit the file "VariationsLableMenu.ascx" and uncomment the line <cms:VariationsLabelEcbMenu id ="varlabelmenu1" DataSourceID="LabelMenuDataSource" DisplayText="<%$Resources:cms,VariationLabelMenuTitle%>" IsCallbackMode="true" runat="server" />
  3. Add the tag <%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %> to the header of your masterpage.
  4. Add <PublishingVariations:VariationsLabelMenu id="labelmenu1" runat="server"/> in your masterpage to show the standard VariationsLabelMenu.
2/5/2007 1:22:21 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, January 30, 2007

To show error details like the stack trace, edit the web.config of your web application:

  1. Change <SafeMode CallStack="false" to <SafeMode CallStack="true"
  2. Change <customErrors mode="On" to <customErrors mode="Off"

Now you will see your full exceptions, no more "unexpected" or "undefined" SharePoint 2007 errors.

1/30/2007 2:24:47 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, January 23, 2007
Add the following StyleSheets to the header of your masterpage:
 
<SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%>" runat="server"/>
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %>" runat="server"/>
 
Use this table to place a formatted version of the authoring menu:
 
<table cellpadding="0" cellspacing="0" width="100%" class="masterContent">
     <tr style="height:0px">
      <td>
       <wssuc:DesignModeConsole id="IdDesignModeConsole" runat="server"/>
      </td>
     </tr>
     <tr>
      <td colspan="2" class="authoringRegion">
         <span class="siteActionMenu">
        <PublishingSiteAction:SiteActionMenu runat="server"/>
       </span>
       <div class="sharepointLogin">
       <!--Authentication for Authors only-->
       <table cellpadding="0" cellspacing="0" >
        <tr>
         <td class="ms-globallinks">
         <!--<SharePoint:DelegateControl ControlId="GlobalSiteLink1" Scope="Farm" runat="server"/>--></td>
         <td class="ms-globallinks">
         <SharePoint:DelegateControl ControlId="GlobalSiteLink2" Scope="Farm" runat="server"/></td>
         <td class="ms-globallinks">
         <wssuc:Welcome id="explitLogout" runat="server"/></td>
        </tr>
       </table>
       </div>
      <div class="console">
       <PublishingConsole:Console runat="server"/>
      </div>
      </td>
     </tr>
    </table>
1/23/2007 6:51:12 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
  1. Enable anonymous access for a web application from the Central Admin.
    - Central Administration Home Page > Application Management > Authentication Providers
    - Select the web application where you want to enable anonymous access
    - Click the "default" Zone
    - Mark the checkbox "Enable anonymous access"
    You don't have to do anything on the IIS Manager. Enabling it from the Central Admin page will also enable it on IIS and modify your web.config.

  2. Explicitly turn it on for the sites you want to be accessed anonymously.
    Browse to your site, click Site Settings > Advanced Permissions > Settings >Anonymous Access and turn on anonymous access for the site.

  3. For further settings search your Sharepoint help for "enable anonymous access".
1/23/2007 6:43:04 PM (Mitteleuropäische Zeit , UTC+01:00)  #    Disclaimer  |  Comments [1]  |