Tuesday, July 17, 2007

Starting a SharePoint Timer Job manually

During 2 days we had the SharePoint environment down due a transaction log too large. The root problem was the recycle bin. We threw a process that updated all the files on the site with the unlimited versioning enabled in its Document Libraries. The process executed each 5 minutes and every execution duplicated the info in the site as an old version of each document. After take off-line the database, detach it and attach it again without the transaction log (see the post that explain it) we could recover the space necessary to work. Then we delete each old version of the documents and send it to recycle bin. After set the quarentine period to 1 day we did not want to wait 1 day to get the space free. For that reason, we made this simple code to execute the SPJob that actually deletes the files in the database when it has been deleted of the second level recycle bin.

SPSite site = new
SPSite("http://<URL>");

foreach (SPJobDefinition job in site.WebApplication.JobDefinitions)

{

if (job.Name == "job-recycle-bin-cleanup")

{

    job.Execute(new
Guid("C864BB7F-7346-4538-9720-2AADB2ED5247"));

}

}


 

The guid that ypu have to pass is the guid of the content database. I retrieve right clicking on the content database in the central administration (remember to substitute the hex code of the hyphens '-'). In this example the guid retrieved was: DatabaseId=%7BC864BB7F%2D7346%2D4538%2D9720%2D2AADB2ED5247%7D

Related Links:
http://experienciasnet.blogspot.com/2006/09/shrinking-log-file-in-sql-server-2005.html

Tuesday, July 10, 2007

How to make your own WSP

When I asked myself this question I thought in the VS2005 extensions for SharePoint. I discovered then that it was only supported for an environment with stand alone installation. I could deploy a solution only the first time (it only gives me an error about a feature not installed). The successive times I get an "Object reference not set to an instance of an object" and VS2005 didn't create the WSP file. Then I find the post about the Timer Job in WSS and a link to the method to deploy the solution without de extensions for VS2005. It seems complex, but it isn't.

Note: I had to activate the feature from the command line (stsadm).

Related links:
http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx
http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx (An example of WSP)

STSADM “Command Line Error”

Today I was deploying a solution to my server through the command line. After pasting command that I had copied from a web I received the "Command Line Error". The solution is to write the command without paste. The reason is the encoding of the pasted text. I found the explanation in the blog in the related links.

Related Links:
http://blogs.msdn.com/sharepoint/archive/2007/02/24/updated-installation-guide-for-the-20-server-admin-application-templates-for-wss-3-0.aspx



 

Friday, June 29, 2007

70-541 – My first SharePoint certification

Today I have passed the 70-541 exam. It is about development in WSS and it is not difficult if you have the key concepts clear. The questions are 80% about the API (managinitems, lists and sites) and the rest is about deploying the solution.

Friday, June 1, 2007

Accessibility, CSS Friendly Controls, AspNet Menu and IE6

If you are developing an accesible site with ASP.NET 2.0 you can use the CSS Friendly Controls Adapters to render the controls without tables. You can access to the project at http://www.codeplex.com/cssfriendly. The current release of the AspNet Menu does not work with IE6 and the menus are invisible. After some investigation I discover that the problem is the Menu.css in the project. I have excluded this file and it shows the menu in IE6. Finally I have discovered what was happening. There is a bug in IE6 with the next class included in the Menu.css:

ul.AspNet-Menu

{


position: relative;

}

If you delete it all will works fine. For that reason I recommend to check the CSS files included in the project and verify it if you detect some strange behavior. In our case we have model the menu in the css of the application.

Special thanks to Edu and Victor who detect it.

Related Links:

http://www.codeplex.com/cssfriendly


 

Monday, April 16, 2007

You may re-try the operation, and you may need to clean up the half-created data first before re-creating.

I encountered this "fantastic" error when I tried to create a new variation in my site. I did that in many other occasions without problems but today it has failed. The result is that the process makes a partial copy of the root variation. I don't know the reason, but I have encountered the causes. It failed when the variation process tried to copy two pages to the destination site. The solution was to delete the two pages that cause the error.

To discover what page are causing the problem you can trace de Content Data Base of your site during the create hierarchies process. You will see that the variation process throws an SQLException due a violation of Primary Key on a table. This is the error that I saw in my event viewer and in the trace: Violation of PRIMARY KEY constraint 'PK__#ExportObjects____56256D26'. Cannot insert duplicate key in object 'dbo.#ExportObjects'.  The statement has been terminated.  If you save the trace in a table and launch a query like this SELECT * FROM MyStoredTrace WHERE TextData like '%name_of_origina_variant%' ORDER BY starttime it will return a lot of rows. To know what is the problematic page search the last processed page.

Another way to discover it is to review the site generated and determine what the first missing page is. It Is probable that this page produces an error when you try to move or copy.


 

Tuesday, April 10, 2007

How to acces to the Web Part Maintenance Page

You only have to append to the url of the page ?contents=1. I don't know the reason but it works.

Related Links:

http://www.google.com
J

 
Online Visitors