Apr
15
2008

SharePoint Manager 2007 - A Must have tool every SharePoint Developer should download

AWESOME tool for SharePoint developer just like .NET Reflector for .Net developer.

SharePoint Manager 2007 

from the same guy who wrote WSPBuilder (another must have tool.. I think)

Words are not enough to describe how amazing this tool is. Go download it now! And you will addict to it.

Finally....we can all stop writing console app just for checking SharePoint Object Model properties. (well.. in most cases)

Download counts for this tool is surprisingly still low (1106 downloads at 16-April-08). That's one of the reasons I post it here to spread word :)

 

Here are some screenshots

View every Solutions installed on server..

James Tsai Blog .Net SharePoint ASP.NET C# - SharePoint Manager 2007 Solutions View

 

View Lists, Lists Definition or even in Browser view..

James Tsai Blog .Net SharePoint ASP.NET C# - SharePoint Manager 2007 Site Collections View

 

View List Schema..

James Tsai Blog .Net SharePoint ASP.NET C# - SharePoint Manager 2007 Schema View

Apr
11
2008

How to query cross-site lists in DataFormWebPart - Part 2. Use XSLT generated from SharePoint Designer to display data

Part 1. Build your own data source for Data Form Web Part

Part 2. Use XSLT generated from SharePoint Designer to display data  

In last post I have described how to build a data source and use it in custom DataFormWebPart to query cross-site lists.

Now, I am going to explain how you can display result data easily by using XSLT from SharePoint Designer.

Like I have mentioned in previous post, you should build data result in specific format. The format respects the XSLT that will be generated by SharePoint Designer. The format looks like this


<dsQueryResponse>

    <Rows>

        <Row Attribute1="" Attribute2=""  Attribute3=""/>

        <Row Attribute1="" Attribute2=""  Attribute3=""/>

    </Rows>

</dsQueryResponse>

Atrribute 1,2,3 can be field name.  

1. Create a new page with DataFormWebPart

Once you have data present in above format. You can then go into SharePoint Designer and open the library/list that your cross-site query will be queried on. And create a new temporary .aspx page in this library.

 NewAspxPage_thumb  

In our case, this page can be created in any sub-site's page library.

cross_list_structure_thumb1  

After you created a new page, insert a data view (DataFormWebPart)  control to this page.

InsertDFWP_thumb  

And select a data source from the data source panel for this control

 ClickForDataSource_thumb1

DataSourceLibrary_thumb1  

In this example we select "Pages" library as our data source. Because we want to use the site columns for the content type used in this page library as display fields. (Same fields we queried in result data in Part 1.)

SelectedLibrarySource_thumb1  

Surely You can create this temporary .aspx page in any place you like. But create it under right site avoid extra works for set up data source library manually. To get site columns you want.

ConnectToDiffLibrary_thumb

 

2. Customise the presentation of DataFormWebPart

Now, you can select all the fields you wanted to display in your cross-site lists DataFormWebPart. And insert them to the control.

InsertSelectedFields_thumb1 

Sample data view will be displayed on the page for you to preview the result.

 

3. Copy XSLT

If everything looks good to you, right click on the DataFormWebPart on the page and select "Web Part Properties..".

In XSL Editor box, copy the XSLT and save it to separate file for your custom cross-list DataFormWebPart to use.  

WebPartProperties_thumb2  


//XSLT saved in CrossList.xsl and use it via code.
//XslLink can also be set from Web Part Properties UI
CustomDataFormWebPart dfwp = new CustomDataFormWebPart();
dfwp.XslLink = "/Style Library/XSL Style Sheets/CrossList.xslt"  

Now, You should be able to display data without any changes to this XSLT. Because display fields matches attributes of our result XML data.

At this stage you have both custom cross-site DataFormWebPart control and XSLT presentation file.

Note

If you changed the display layout in Step 2 to enable Sorting and Filtering on column headers. You may find filtering does not work properly. It returns no data for you to perform filtering when you click on column headers.

 EnableFIlteringSorting_thumb1 

NoFilteringData_thumb1

It is because the default implementation of the method (the one return filtering data)  in DataFormWebPart class does not support our custom data source.

 

Coming up..

In Part 3. I will post about how to get filtering to work on column headers!

Apr
3
2008

Code blocks are not allowed in this file - SharePoint error with custom page layout

Yes, I do have C# code in custom page layout. And you probably thinking it is just another post about putting "<PageParserPath />" tag inside web.config.

But the answer is No. I managed to pin down the problem without having <PageParserPath /> tag. Well.. at least in my case.

Problem -

I got this error when I was creating a new publishing page, base on the custom page layout I have deployed to SharePoint site.

James Tsai .Net Blog - C# ASP.NET SharePoint VSTO - Page Layout code block error

Solution

The reason I know <PageParserParth /> is not the answer to this problem is that, only two out of seven page layouts I deployed having this issue.

So I opened those "broken" page layouts from the site in SharePoint designer and found following code got injected to the bottom of my custom page layouts


<html xmlns:mso="urn:schemas-microsoft-com:office:office"
xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head> <META name="WebPartPageExpansion" content="full"> <!--[if gte mso 9]><xml> <mso:CustomDocumentProperties> <mso:PublishingPreviewImage msdt:dt="string"></mso:PublishingPreviewImage> <mso:ContentType msdt:dt="string">Page Layout</mso:ContentType> <mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription> <mso:PublishingAssociatedVariations msdt:dt="string">
</mso:PublishingAssociatedVariations> <mso:PublishingHidden msdt:dt="string">0</mso:PublishingHidden> <mso:PublishingAssociatedContentType msdt:dt="string">
;#Agenda item;#0x010100C568DB52D...;#</mso:PublishingAssociatedContentType> </mso:CustomDocumentProperties> </xml><![endif]--> <title>Dummy Content Type</title></head>

I couldn't figure out how this got into my page layouts . But I am sure that SharePoint treated those "broken" page layouts differently as to other working page layouts.

I compared them side by side, read about PlaceHolderPageTitle is the root of all evil  post. I found in my broken page layouts they all got lower case <asp:content /> tag for PlaceHolderPageTitle place holder. So I changed <asp:content /> to <asp:Content />, and it fixed the problem!


<asp:Content contentplaceholderid="PlaceHolderPageTitle" runat="server"> <SharePointWebControls:FieldValue id="PageTitle"
FieldName="Title" runat="server"/> </asp:Content>

Unlike Waldek's situation in the his post, I do have PlaceHolderPageTitle place holder in my page layouts. So this place holder is case sensitive? (because all my other place holders still use lower case <asp:content /> tag. )