Donnerstag, 29. September 2011

SharePoint 2010 customErrors mode

Are you getting crazy getting no error details even if you allready set customErrors to Off on the web.config?

Just read this Post, I think it may help you out:

SharePoint 2010 customErrors mode

The secret lays here:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config

Montag, 19. September 2011

SharePoint Foundation Search not working

My SharePoint Foundation Search was not working. When I was searching for an Item in a list I was just getting this message "We did not find any results for host."

I started the SharePoint Foundation Search Service on the server.
I added the Managed Account.
And I started the SharePoint Foundation Search Refresh.

But I allways got the same message.

Then I looked  in the Event Viewer and I found following "SharePoint Foundation Search" Warning (Event ID: 14):

The start address sts4://win-u71mv1i4epi/contentdbid={521dee71-a532-4935-b906-5e9ed5f49d33} cannot be crawled.
Context: Application 'Search_index_file_on_the_search_server', Catalog 'Search'
Details:  The object was not found.   (0x80041201)

I found this Forum Entry: Search Problem with SharePoint Foundation on SBS 08
And there I found the source of my Problem: It was the alternate access mapping

here what I got in the central administration.

and here what I had in the IIS Manager

So I needed to add on binding and my problem was resolved. Here what it should look like:

Mittwoch, 7. September 2011

How to change the order in the SharePoint Foundation alternative SPSiteMapProvider

I was trying to improve the navigation for a customer without investing to much in money and time. I found a solution discribed in this blog:
Easy and Simple SharePoint 2010 Dropdown Navigation bar that works no scripts, no web.config, works on hosted providers

In summary: go to the masterpage and replace this part:
<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>

with this:
<SharePoint:AspMenu
 ID="SPSiteMapProvider"
 Runat="server"
 EnableViewState="false"
 DataSourceID="SiteMapDataSource1"
 AccessKey="<%$Resources:wss,navigation_accesskey%>"
 UseSimpleRendering="true"
 UseSeparateCss="false"
 Orientation="Horizontal"
 StaticDisplayLevels="2"
 MaximumDynamicDisplayLevels="3"
 SkipLinkText=""
 CssClass="s4-tn"/>
 <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource1"/>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
 <Template_Controls>
 <asp:SiteMapDataSource
 ShowStartingNode="False"
 SiteMapProvider="SPSiteMapProvider"
 id="topSiteMap"
 runat="server"
 StartingNodeUrl="sid:1002"/>
 </Template_Controls>
</SharePoint:DelegateControl>
Unfortunately this Navigation provider sort the Items using ASCII order. He don't care about the order defined in the ToNavigationConfiguration interface.

So how can I sort the sites anyhow? Just add whitespaces to the title of the Web that you want to be on the first. Example:

Pages with the titles "First", "Second", "Third", "Fourth" and "Fifths" will be shown in this order:
"Fifths", "First", "Fourth", "Second", "Third"
To get them in the right order change the name to this:
"    First", "   Second", "  Third", " Fourth" and "Fifths"

And don't worry the whitespaces are trimmed in both the Navigation and the Page title.

It's not the most elegant way, but it works.

Enjoy and share

Dienstag, 6. September 2011

Add Circulation List to SharePoint 2010 Web using PowerShell


PowerShell is great. I'm working on scripting a whole deployment process with PowerShell. Yesterday I got stuck in a problem that costs me about 6 hours of my life. 
If you want to add a list to a SPWeb you will find in a lot of blogs this description:

$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::Circulation
$spweb.Lists.Add(MyCirculation“,"Description",$listTemplate)

And guess what? It works fine for a lot of list templates. But then I tried with “Circulation” and I got this error:


Exception calling “Add” with 3 argument(s) “Invalid list template.”

I tried a lot And I found out that I need to use this Add Method:
http://msdn.microsoft.com/en-us/library/ms448694.aspx

So I tried with this code:

$listTemplate = [Microsoft.SharePoint.SPListTemplateType]:: Circulation
$spweb.Lists.Add(“MyCirculation“,"Description", $spweb.Url, "a568770a-50ba-4052-ab48-37d8029b3f47", $listTemplate, 2)

You can get the feature ID from this location “14/TEMPLATE/FEATURES/CirculationList”
here I got this error message:

Exception calling "Add" with "6" argument(s): "The file or folder name contains characters that are not permitted.  Please use a different name

So I thought the error must be in the Url but what Url does the Method require?
Finally I tried with this:


$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::Circulation
$spweb.Lists.Add(“MyCirculation“,"Description", “MyCirculation“, "a568770a-50ba-4052-ab48-37d8029b3f47", $listTemplate, 2)

I don’t know why, but it worked. I just used the same thing for Title and Url.
I only tried this out with Circulations, but as whereabouts throw the same error I think the solution must be the same.

As I said this cost me about 6 hours trying and searching for a solution. I hope it will be useful to someone else.

Enjoy and Share :)