cloud.net

Wednesday, August 6, 2008

Filtering SharePoint List Libraries with Web Part Filters

Sometimes you need to filter data (ListViews/DataViews/Other web parts) based on some criteria be it the persons name, their email, a specific date range or from a parameter.
Microsoft provide a number of these Web Parts called filters. The problem is they only provide these in the Enterpri$e ver$ion.

So I made my own and I'm sharing them with you....

ray1.net Web Part Filters feature is comprised of 6 web parts.


  1. ray1.net Content Connector. This is a simple Literal Control that renders the value of a connection, or the text you specify. You can use it with, say the UserFilter and render some text that says "Welcome to my site UserFilter value!"
  2. ray1.net Filter Web Part: Current Page. This web part provides a filter connection that send information about the current page. The page needs to be in a list. You can use this to filter content based on who created the page or the file size or the modified date.
  3. ray1.net Filter Web Part: Date. This web part provides a filter connection that sends information about a selected date or date range. Say you had a DataView web part that sent a parameter to an SQL stored procedure.
  4. ray1.net Filter Web Part: QueryString. This filter accepts a QueryString parameter and connects to another web part. Pretty simple really, name the filter the same as the querystring parameter and your done.
  5. ray1.net Filter Web Part: User Name. This web part provides a User Name connection filter. This web part makes this feature incompatible with WSS v3, as I use the "Microsoft.Office.Server.UserProfiles.UserProfileManager" class.
  6. ray1.net Filter Web Part: Web ID. This web part provides a filter connection that sends the Web ID. Another simple one, but useful... Say you have a bunch of sites using the same template and you wanted to filter an SQL query.

All the filters accept multiple connections, and this is what they look like in edit mode.


This is what they look like normally


Download link: ray1.net Web Part Filters
To do: I could add a Text Filter and maybe change the Content Connector to accept n number of connections.

Keywords: Filter, web part, listview, SPSlicerBaseWebPart, ToolPart, IWebPartField, GetConnectionInterface, Connection Consumer Provider

Monday, June 16, 2008

Report Server - SharePoint: IReportViewerMessages or could not be found

If you have Report Server running in a virtual directory under a SharePoint web app.

Error: The type Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c does not implement IReportViewerMessages or could not be found.

Cause: Look in your SharePoint web.config file you'll see
<add key="ReportViewerMessages" value="Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />.

Fix: I looked at the Microsoft.SharePoint.Portal.Analytics Namespace and couldn't find a UI.ReportViewerMessages, so I just removed it from the web.config and I haven't experienced any issues.
You can also remove the setting from your ReportServer web.config's just add:
<appSettings>
 <remove key="ReportViewerMessages" />

</appSettings>

Tuesday, June 10, 2008

Report Server Error: The request failed with HTTP status 400: Bad Request

This also applies to the error message: Microsoft.ReportingServices.UI.Global+RSWebServiceWrapper+CantCommunicateWithReportServerException: The report server is not responding. Verify that the report server is running and can be accessed from this computer.

This took me a little while to figure out, but my initial suspicion was that it was related to the fact I was using it in a Host Header site, ei: I had changed lmhosts or I had multiple web sites using port 80.

Cause:

Report server uses the machine name when setting the config files, but when it tries to reference the url it can't be found because it's in another web site. In my case the server was called MOSSDEV, and the report server virtual directories were in a web site called premisys.

Fix:

  1. Open "RSWebApplication.config" in the "Report Manager Virtual Directory". Right click the virtual directory icon in inetmgr, choose open. Default is: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager
  2. Enter the full Report Server URL in the <ReportServerUrl> node. Eg: <ReportServerUrl>http://premisys/ReportServer</ReportServerUrl>
  3. Delete the <ReportServerVirtualDirectory> value but not the node.
  4. Open "rsreportserver.config" in the "Report Server Virtual Directory". Default is: C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer
  5. Change the <urlroot>http://<servername>/ReportServer</urlroot> to match your URL.

Monday, May 26, 2008

Customizing the sharepoint search control

There are a couple ways of doing this.
  1. Modify ..\12\TEMPLATE\FEATURES\ContentLightup\Controls\searchArea.xml
  2. Modify ..\12\TEMPLATE\CONTROLTEMPLATES\searcharea.ascx
  3. Create a new feature and control
  4. Create a new feature that changes parameters for "SmallSearchInputBox"
I believe option 4 to be the best as it uses Microsoft.SharePoint.PortalWebControls.SearchBoxEx class and you don't need to create a new control.
There are a large number of properties you can use to customize the control and you should find the one you're looking for microsoft.sharepoint.portal.webcontrols.searchboxex_properties.
So how do we customize it? Create a new feature.
  1. Create a new directory anywhere eg: C:\RPSearchFeature
  2. Create a new manifest.xml in C:\RPSearchFeature with the following:
    <?xml version="1.0" encoding="utf-8"?>
    <Solution
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SolutionId="GENERATE_A_GUID" ResetWebServer="True" xmlns="http://schemas.microsoft.com/sharepoint/">
    <FeatureManifests> <FeatureManifest Location="PortalSearch\feature.xml" /> </FeatureManifests> </Solution>
  3. Create "C:\RPSearchFeature\PortalSearch\feature.xml" with:
    <?xml version="1.0" encoding="utf-8"?>
    <Feature  Id="7095f774-1efa-4879-b074-ff211f5559c7"
              Title="Small Portal Search"
              Description="Smaller search bar without scopes"
              Version="12.0.0.0"
              Hidden="FALSE"
              Scope="Web"
              DefaultResourceFile="core"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests> <ElementManifest Location="elements.xml"/> </ElementManifests> </Feature>
  4. Create "C:\RPSearchFeature\PortalSearch\elements.xml" with:
    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
     <Control
      Id="SmallSearchInputBox"
      Sequence="25"
      ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" 
      ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
      <Property Name="SearchResultPageURL">/search/results.aspx</Property>
      <Property Name="FrameType">None</Property>
      <Property Name="DropDownMode">HideDD_NoScope</Property>
      <Property Name="TextBoxWidth">140</Property>
      <Property Name="ShowAdvancedSearch">false</Property>
     </Control>
    </Elements>
  5. Wrap the feature up in to a solution "SearchFeature.wsp" with cabpack
  6. Deploy the solution.
  7. Enable the feature (Scope is web, but you can change it to site if that suits you).

The instruction that will enable these parameters over the default is the sequence number. The default sequence is 99, so anything below 99 will load first. The parameters I'm using set the "SearchResultPageURL", hide the scope drop down and remove the advance search link.

Wednesday, May 21, 2008

Application Event Log: Unable to connect publishing custom string handler for output caching.

After adding the Reports Services virtual directories to a sharepoint site/web application you see the below in the event log.

Event Type: Error
Event Source: Office SharePoint Server
Event Category: Publishing Cache
Event ID: 5785
Date: 21/05/2008
Time: 3:01:52 PM
User: N/A
Computer:
Description:
Unable to connect publishing custom string handler for output caching. IIS Instance Id is '1957155781', Url is 'http://localhost/ReportServer/ReportService2005.asmx'.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Cause: microsoft.sharepoint.publishing.publishinghttpmodule is trying to cache an unmanaged path.

Fix: Remove this httpmodule from the ./ReportServer virtual directory web.config.

    Steps:
  1. Open the web.config file (D:\Program Files\Microsoft SQL Server\MSSQL.1\Reporting Services\ReportServer\web.config)
  2. Locate the <httpModules> node, if it's not there create it below the <httpHandlers> node.
  3. Add the following <remove name="PublishingHttpModule" />.
Everytime you call a report or the reportserver URL/web service SharePoint tries to turn caching on and it's not a managed path it throws an error, so we need to remove the module in the reportserver.

Friday, May 16, 2008

Movie of the day: Mr. Nobody

I watched the extended version of Mr. Nobody the other night. I thought director Jaco Van Dormael did a fantastic job with the great attention to detail. Jared Leto was good too.

Mr. Nobody
imdb.com

Friday, May 2, 2008

Movie of the day

I watched an entertaining movie with Christian Slater the other day I feel is worth a mention...

He Was a Quiet Man
imdb.com