Archives

Archives / 2004 / June
  • Getting started on XSD

    UPDATE: My excuses to VS.NET 2003, I just did not find some of the features of the schema editor and xml editor. Joshua Flanagan thanks for pointing this out!

    Although I'm working with XML for years and years, have used DTD's and schema's and on a global level know quite well where to apply which technology I never really wrote my own XSD. Most of the time someone else in the project did this part.

    OK, so I was constructing my first schema for a configuration file format for a tool I'm working on: the MacawSharePointSkinner (a tool to modify the looks of SharePoint without having to dig into the almost non-existent SharePoint way of changing the SharePoint looks).

    I started out with VS.NET's schema designer. This sucks big time It is “sub-optimal“

    • Terrible sub-optimal documentation
    • no possibility to set attribute values like minOccurs and maxOccurs through the designer F4 -> properties
    • no functionality to derive a schema from an existing XML file
    • no functionality to generate a test XML document based on the defined schema
    • no functionality to generate documentation for the schema
    • no functionality to check my text XML document against the schema Automatically done when referencing the schema

    Yesterday at TechEd Europe I walked into Altova XmlSpy in the exhibition hall, just a few hours after a stressful night with VS.NET. I explained what I needed, and they demonstrated their tool. I loved it! Today I fired up the full-functional demo copy and tried to get started.Still some trouble but I did get much further.. my schema is finished! Love the tool

    What I missed in XmlSpy is good documentation on XSD itself, for example I could not get the following defined:

    :
    <foo a=“x“/>
    <bar a=“x“>u</bar>
    <bar a=“y“>v</bar>
    <bar a=“z“>w</bar>
    :

    Where foo and bar can be used mixed.

    • xs:sequence defines a fixed sequence
    • xs:all does only allow minOccurs=0 maxOccurs=1, not maxOccurs=unbounded

    It is just not possible to define this in schema (as far as I know), the tools says that something is wrong when trying those alternatives, but don't tell you why...

    After searching for some good documentation for starters I came up with the following links to be read in sequence, although the first article was good enough for me to finish my schema:

  • Backup and restore of SharePoint Portal Server 2003

    I got the following question through e-mail, and I thought I try to reply here, so if i'm talking nonsense other people can correct me:

    I'm sorry to be bothering you, but I don't know what else to try and our team is reaching the peak of frustration . We're trying to recover a Sharepoint Portal Server 2003 on another machine (read «move it to a new machine» - preserve the same machine name, same IP address, etc, since it's purpose is to substitute the old one), we successfully recover the portal using the Sharepoint Portal Server Backup and Restore Tool, however when we try to access the portal site we receive this message:

    «Cannot complete this action.

    Please try again.»

    The SharePoint Sites seem to be restored ok and seem to be working (Team Sites, Document Workspaces, etc). - BUT the user logins fail to work however, only the username «Administrator» is working.

    When we try to access the PORTAL we receive the error describe above («Cannot complete this action .» - see the attached screenshot), on every page, meaning we can't even take a peek at the site settings, since those also return the error.

    We don't know what else to try . and all the documentation we find is vague and doesn't give a step-by-step how-to which could point us to «what the hell are we doing wrong?!» (this includes the «SharePoint Products and Technologies Resource Kit Chapter 28: Disaster Recovery (Preview)» http://www.microsoft.com/downloads/details.aspx?FamilyID=60bd8fe5-804e-4a49-83db-ea41beb80f3b&displaylang=en ).

    I've read somewhere that you might be required to recreate «some registry keys», but can't find any documentation that states which ones .

    I don't know if this information might be of any use, but we have both webpart's installed using the stsadm.exe tool (.cab files) and webpart's (.dwp) uploaded directly to the WebPart Library via the Site Settings on the original Portal Site that we are trying to move to a new machine. We have recreated by hand the Active Directory domain controller on the new machine as well, and double checked all the user and group informations.

    My reply:

    You probably had the situation that you did rebuild the complete machine that also acted as the only active directory domain controller, and that you recreated the users by hand. This means that all users got new SID's (unique ID's). If you had another AD controller, the new AD domain controller would synchronize existing account using correct SID's. The Administrator account does ALWAYS have access to SharePoint as a portal administrator (has all the rights). What you can try is to empty the UserInfo table in the XXX_SITE table, and probably recreate all security in your portal (maybe groups will remain, so if you are using groups and cross site groups you are lucky, you only have to add the correct account to these groups again!). Please note that this are all assumptions, and that I have no idea if it will solve your problem or maybe completely ruin your installation. I hope that other people who have more insight in this topic will respond as well!

  • AlternateHeader magic to style your SharePoint pages

    Both in the portal and in team sites the underlying functionality is managed by an SPWeb. SPWeb functionality uses many generic ASPX pages defined in the folder Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS\1033. All pages in this directory look at the SPWeb property AlternateHeader. This property can be used to set the URL for an alternate .aspx page to use for rendering the top navigation area in SharePoint pages. Each ASPX page in this directory contains code to determine if the default header must be rendered or the specified header. it contains code like:

    <%
    string alternateHeader = SPControl.GetContextWeb(Context).AlternateHeader;
    if (alternateHeader == null || alternateHeader == "")
    {
    %>
    <TR><TD WIDTH="100%" COLSPAN="3"><!--Top bar-->
    <TABLE class=ms-bannerframe cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
    <TD vAlign=center noWrap><IMG id=onetidHeadbnnr0 alt=Logo src="/_layouts/images/logo.gif"></TD>
    <TD class=ms-banner id=HBN100 vAlign=center noWrap width="99%"><!--webbot Bot="Navigation" startspan--><?XML:NAMESPACE PREFIX = SharePoint /><SharePoint:Navigation runat="server" LinkBarId="1002"></SharePoint:Navigation></TD>
    <TD class=ms-banner>&nbsp;&nbsp;</TD>
    <TD class=ms-banner style="PADDING-RIGHT: 7px" noWrap><SharePoint:PortalConnection runat="server"></SharePoint:PortalConnection></TD></TR></TBODY></TABLE></TD></TR>
    <%
    }
    else
    {
        Server.Execute(alternateHeader);
    }
    %>

    Normaly this AlternateHeader is empty, but all SPWebs underlying the areas in the portal have this property set to PortalHeader.aspx, and all MySites have this property set to MySiteHeader.aspx. These files can be found in the folder Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS\1033.

    PortalHeader.aspx:

    <%@ Page language="C#"     Inherits="Microsoft.SharePoint.Portal.SiteAdminPageNoBrowserCheck,Microsoft.SharePoint.Portal,Version=11.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <tr> <td colspan="3" width="100%">
     <SPSWC:PageRedirectControl runat="server" />
     <SPSWC:ExternalHtmlResourceElement runat="server" HtmlElement="StylesheetLink" FileContext="SharedStyle" FileName="ows.css" />
     <SPSWC:ExternalHtmlResourceElement runat="server" HtmlElement="StylesheetLink" FileContext="SharedStyle" FileName="menu.css" />
     <SPSWC:ExternalHtmlResourceElement runat="server" HtmlElement="StylesheetLink" FileContext="SharedStyle" FileName="sps.css" />
     <SPSWC:CustomCSSResourceElement runat="server"/>
     <SPSWC:PageHeader id="PageHeaderID" runat="server" PageContext="SitePage" ShowTitle="false" HelpID="NavBarHelpHome"/>
     <div class="ms-phnav1wrapper ms-navframe"> <SPSWC:CategoryNavigationWebPart runat="server" id="HorizontalNavBar" DisplayStyle="HorizontalOneLayer" /> </div>
    </td> </tr>

    MySiteHeader.aspx:

    <%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <SPSWC:PersonalSpaceNavigationResponse runat="server" />
    <tr><td colspan="3" width="100%">
     <SPSWC:PersonalSpaceNavigation runat="server" />
    </td> </tr>