Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, February 6, 2008

Using VS 2008 Code Metrics tool for SharePoint projects.

I ran the Code Metrics tool on a VS 2008 project containing a set of SharePoint web parts. The tool failed to show code metrics for Projects that had a reference to Microsoft.SharePoint DLL. Given below is the message I received.

An error occurred while calculating code metrics for target file 'D:\MyFolder\Projects\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe' in project ConsoleApplication1. The following error was encountered while reading module 'Microsoft.SharePoint': Security attribute type does not have a default constructor: Microsoft.SharePoint.Security.SharePointPermissionAttribute, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, Publickeytoken=71e9bce111e9429c.

I found the same issue reported on Microsoft connect site, but it had been closed since Microsoft was unable to reproduce the issue. So I provided the steps to reproduce the issue and got back to my work.In the process, I created a dummy console application with a reference to Microsoft.SharePoint. After submitting the repro steps, I had a good look at the error message and thought: "What if I include a reference to the Microsoft.SharePoint.Security namespace? Will that help? Let me try..." I did that and ran the Code metric tool. Pronto, I had the code metrics for the SharePoint project in the Code Metric Results section!!! Doing something for the community somewhere down the line helps you, isn't it? :)

So if you run into a similar issue when using the Code Metrics tool, just add a reference to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.Security.dll" and re-calculate the code metrics.

Sunday, January 6, 2008

The crawler could not communicate with the server

Recently, I saw the following error message logged by Office SharePoint Server Search service.
"The crawler could not communicate with the server"

The Search service had been working perfecly just a few days back. So this error, out of the blue, did surprise me. A bit of calm investigation revealed that the password associated with the service account had expired. Changing the password and restarting the service fixed this issue!

Tuesday, September 11, 2007

How to fix SharePoint error: Cannot complete this action

While my team was working on customizing a SharePoint site, we encountered the following error message

Cannot complete this actionEvent message: An unhandled exception has occurred. Process information:
Process ID: 1964
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: SPException
Exception message: Cannot complete this action. Please try again.
Thread information:
Thread ID: 6
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at
Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(String bstrUrl,
String bstrListName, String bstrViewName, String bstrViewXml,
SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback,
ISPDataCallback pPagingCallback, ISPDataCallback pSchemaCallback) at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() at Microsoft.SharePoint.SPListItemCollection.get_Count() at ProjectCreation.ProjectCreation1.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

This information was hardly of any use in fixing the issue. We discovered the precise information in the SharePoint log files in%Program Files%\Common Files\Microsoft Shared\web server extensions\12\LOGS.

Given below is the message logged when the error was encountered.
Failed to find tag corresponding to ID "112", tried both onet.xml for site definition ID "1" language "1033" and global site definition. Operation failed.

Further investigation revealed that in the process of customizing the site, the team had overwritten the global version of ONET.xml file(218 KB) witha version that was 17 KB in size and it did not have ListTemplate tag. Replacing it with the original file resolved the issue.

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...