Query Component 0 not responding


Recently I went back to my development VM which contains AD, Win Server 2008 R2, SharePoint 2010, etc. I use this VM to build a number of demo sites and when I tried to search, I cannot get any results.

I went to Search Administration to see what is the issue, whether I turned off the crawl, did not set the correct content source, or what. The first thing I see is the propagation status is Query Component is not responding. So my first instinct is to check the error log in event viewer and ULS. The error I got is:

* file copy failed (error 0x80070035: The network path was not found). 0x80070035, source C:\Program Files\Microsoft Office Servers\14.0\data\office server\applications\[Guid]-crawl-0\projects\portal_content\indexer\cifiles001000F.ci, destination \\Machine Name\[Guid]-query-0\[Guid]-query-0\Projects\Portal_Content\indexer\CiFiles000.0001000F.ci.cp) [indexpropagator.cxx:403] d:\office\source\search\native\ytrip\tripoli\propagation\indexpropagator.cxx

Looking at this error, I assume it has to do with SharePoint unables to copy/move index files from crawl temp folder to query search folder. So to resolve this, I went to ensure WSS_WPG group has full control access to the destination folder.

However, when I looked at the shared folder permissions and security, WSS_WPG group already has the appropriate access.

The next thing I do is to ensure I disable the loopback check, because I only use a single server for my environment, and Windows Server 2008 has a loopback check. So I follow the steps specified in http://support.microsoft.com/kb/896861

After disabling the loopback check and recreating a new Search Service Application, I checked whether the propagation to Query component has been successful. Unfortunately, it gave me the same error.

Then I remember that I use to have performance issue with this VM and I disabled a number of services and uninstall the unnecessary components. One of the things I uninstalled is File and Printer Sharing for Microsoft Networks in my network card properties. So I installed it back in the network card.

After restarting the machine, and recreating the Search Service Application, I ran the fresh crawl and hope for the best. Couple minutes later (since it only contains a number of demo sites with minimal content), I can see successful propagation. Yay me!!

So in summary, if you have a problem with Query Component 0 not responding, please ensure you check:

  1. WSS_WPG has the right permissions to the shared folder
  2. If it is a single development server, ensure you disable loopback check
  3. Ensure you have File and Printing Sharing for Microsoft Networks installed in your network card.

That’s all from me. Happy SharePointing!!

SharePoint 2007 – Predefined Table format


During the implementation of our project, we needed to create predefined table format that can be used in rich text editor. In order to achieve this, we updated the HTMLEditorTableFormat.css that resides in 12 Hives/Template/Layouts/1033/Style folder with new styles in the provided CSS classes.

However there are already existing table formats which were added previously by other projects. And with SharePoint 2007 SP1 (my client is yet to upgrade their environment), we found an issue where the new format that we defined do not show up in the drop down list selection when user wants to use a predefined table format.

When SharePoint detects that there are predefined table formats that are not part of the out-of the box table formatting, SharePoint will strip the out-of the box formats and only display the custom ones as part of the selection. For some reasons, the new formats on top of the previously defined format cannot be displayed (it looks like it’s being cached somewhere unknown).

To get around this issue, I come up with a change that will force the display of all available predefined table formats. In order to do this, you will need to change SharePoint system file (so this is not officially supported, and make sure you backup the original file).

What you need to do is to update the RTE2ETable.aspx in the 12 hive/Template/Layouts. Replace the following line of code:

var availableTableStyleNumbers = getAvailableTableStyleNumbers(tableValidRules, tablePrefix);

with

var availableTableStyleNumbers = getAvailableTableStyleNumbers(tableAllRules, tablePrefix);

Once you save the file, the drop down list in selecting the predefined table formats will display all available formats.

Hope this is useful for you.

Happy SharePointing.

SharePoint 2007 – SPWeb Navigation properties


To set SPWeb Navigation properties through code, you can use:

  • SPWeb.Navigation.UseShared for top navigation. If you set SPWeb.Navigation.UseShared = true; it will inherit top navigation from the parent web.
  • SPWeb.AllProperties[“__InheritCurrentNavigation”] for Quick Launch navigation. If you set SPWeb.AllProperties[“__InheritCurrentNavigation”] = “False”; it will only display navigation below the current site.
  • SPWeb.AllProperties[“__NavigationShowSiblings”] for displaying navigation on sibling site. If you set SPWeb.AllProperties[“__NavigationShowSiblings”] = “True”; it will display navigation from the sibling sites.

Hope this helps.

SharePoint 2007 – Applying new page layout to publishing site default.aspx


Recently while working on a client site to create a new extranet site, one thing I found that is annoying on SharePoint 2007 is that I cannot change the default.aspx, that is created automatically when you create a publishing subsite, to use my new page layout.

The workaround to do this is by creating a new page using the intended page layout, and set the subsite welcome page to the new page.

However, in my project, I have to do the workaround for 700 plus subsites. To make my life a little bit easier in deploying this project, I wrote a custom solution to help me achieve this.

The following is the snippet of my code:

using (SPSite site = new SPSite(url)) {
using (SPWeb web = site.OpenWeb())  {
SPContentTypeId ctId = SPContentTypeId.Empty;
using (SPWeb rootWeb = site.RootWeb)  {
//Find the content type that is associated to the new page layout
SPContentType ctWelcomePage = rootWeb.ContentTypes[“Welcome Page”];
ctId = ctWelcomePage.Id;
}
if (ctId != SPContentTypeId.Empty) {
PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);
PageLayout[] pLayouts = pWeb.GetAvailablePageLayouts(ctId);
PageLayout pLayout = null;
//Find the page layout that we want to use for the new page
foreach (PageLayout pl in pLayouts) {
if (pl.Name.Equals(“MyWelcomePage.aspx”,                   StringComparison.InvariantCultureIgnoreCase))

{

pLayout = pl;

break;

}

}
if (pLayout != null) {
PublishingPageCollection pages = pWeb.GetPublishingPages();
//Create new default page using our chosen page layout
PublishingPage page = pages.Add(“MyNewDefault.aspx”, pLayout);
page.Title = “Home”;
page.Update();
pWeb.DefaultPage = page.ListItem.File;
pWeb.Update();

//By default, Pages will have approval workflow. Just ensure you approve the page
if (page.ListItem.File.CheckOutStatus != SPFile.SPCheckOutStatus.None) {
page.ListItem.File.CheckIn(“New page with proper page layout”);
}
page.ListItem.File.Publish(“New page with proper page layout”);
page.ListItem.File.Approve(“New page with proper page layout”);
}
}
}
}

Of course if you are neat-freak, you can delete the existing default.aspx, rename the new page we created to default.aspx.

For my case, I created a console application that helps me during deployment to automatically create default page using my page layout throughout my subsites.

Note that to use PublishingWeb class, you need to add reference to Microsoft.SharePoint.Publishing.dll that can be found in 12 hive under ISAPI folder. And ensure you reference Microsoft.SharePoint.Publishing in your code.

Happy coding…

p.s: Apology for non-tabbing codes. WordPress keeps losing the tabbing on the code snippet.

Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word.


Ever get this error message when you try to view or edit Word Document within the browser for SharePoint 2010?
 
" Word Web App cannot open this document for viewing because of an unexpected error. To view this document, open it in Microsoft Word"
 
There are a number of possibilities that caused this issue. The issues that I encountered is with my standalone development VM, which is a Windows Server 2008 R2 Standard x64 with a DC role enabled.
 
First issue I encountered is due to having a DC role within the SharePoint server. To resolve this issue, Jie Li posted a solution for this, which involves executing several PowerShell commands (http://blogs.msdn.com/b/opal/archive/2009/11/16/installation-notice-for-sharepoint-2010-public-beta.aspx)
 
However, I encountered second issue that took me awhile to notice that it got nothing to do with my configuration. What I found is that the error will still occur if your Word document has Track Changes on. For some reasons, Word Web App does not support word document that has Track Changes.
 
Once I adjusted my document, it works like a charm.
 
I will encourage my users to leverage version control and version comparison function within Word, instead of Track Changes for my site that needed to use Office Web App, and I will suggest for you to do the same.
 
Happy SharePointing! 

Internet Explorer 9 Beta (Updated with RC)


So I finally managed to install Internet Explorer 9 Beta RC. My first impression is good. I like the minimal approach on the UI. However, there are  few shortcomings that I hope Microsoft will fix it for final release since it is a deal breaker for me:
  • I dislike the display of frequently visited sites when I open the new tab, because it displayed up to the page level. I prefer if I have the control to set whether I want the site or page level.
  • It does not seem like IE 9 Beta is fully integrated with SharePoint 2010. It is such a shame and forced me to downgrade to IE 8. Hopefully the fix comes soon.
  • I enabled ClearType in rendering the page, however it looks a bit fuzzy on my work laptop. It is unfortunate that such a wonderful browser cannot render sharp font text. Perhaps it is due to my laptop’s graphic card.
  • The page loading could be more prominent, since I spent a lot of time waiting for a response when I connect to SharePoint 2010 in my VM and unsure whether the page is loading or not.

I guess I will wait until the full release before making my judgement on whether I switch from Google Chrome to IE 9.

I must say that I am quite pleased with IE9 RC. The progress wheel on the tab, though it is small, now show the correct progress while the page is loading. I also like the fact that I can move the tabs into separate row, since I look at URL a lot as a SharePoint consultant.

Overall feel for IE9 RC is that it is snappier and able to load most of the websites I go regularly.

I am going to give it a go for couple months, but so far my impression of IE 9 RC is very good :)

Delete files through SharePoint Designer data view webpart


 

In keeping with the scary Halloween theme, I would like to share a quick tip on how to provide SharePoint Designer data view webpart the ability to delete file (gasp…)

In order to achieve this, we will have to tinker with the xslt that is generated by the data view webpart. So first, you will need to add the dataview webpart on your page to display the contents of document library. You can also use the webpart to aggregate the contents from multiple document libraries. Once you have done that, you will need to add a column (any column will be fine), where we will replace the content of that column to provide the delete link.

Once you add the “dummy” column, locate that in the source view. Replace that with the following:

<a href="javascript:SubmitFormPost(‘/[Relative site]/_vti_bin/owssvr.dll?Cmd=Delete&amp;List=[List GUID]&amp;ID={@ID}&amp;owsfileref={@FileRef}&amp;NextUsing=[Page to go after delete]’);" onclick="return DeleteItemConfirmation();">Delete </a>

Replace the following:

  • [Relative site] = The relative site where your document library is (e.g. /sites/test)
  • [List GUID] = The list GUID. You can find it easily by looking at the web address URL when you browse to list settings (e.g.: =%7B9A3C5BDF%2DDA36%2D4D48%2DBE5D%2D7CAC5B0C9975%7D)
  • [Page after delete] = The page you want redirection to once the delete function is called. (e.g.: /sites/tests/pages/delete_dataview.aspx)

It is scary how simple we can provide delete functionality to end users. However, you do not need to worry. This delete function does exactly what the delete function through SharePoint UI, so if you have recycle bin, then the document will be sent to it.

Note that if your dataview webpart aggregates the contents from multiple document libraries, then you need to provide separate links for separate document libraries, since you will need to pass appropriate document library GUID. What I have done for my dataview webpart is to provide choose-when-otherwise clause of XSLT.

Happy Halloween and happy coding…