Mittwoch, 7. April 2010

Sharepoint config file SolutionId

Was genau ist eigentlich bei einer Sharepoint Solutions die Id? Es ist nicht die Guid, welche in der AssemblyInfo.cs steht. Erstelle ein Package und dann gehe in folgendes Verzeichnis: pkg/Debug/[Dein Solutionname]/manifest.xml. Öffne die Datei und Du siehst oben die SolutionId.

What exactly is the solution-id in a Sharepoint solution? It is not the guid that is found in the AssemblyInfo.cs file. Build a package and then go to this folder of your solution: pkg/Debug/[your solution-name]/manifest.xml. Open this file and on top you find the solution-id.

Setup Tool Sharepoint 2010 Error: SharePoint Server 2010 is not installed

Wenn man seine Controls/Features mit dem Setup Tool installiert, dort dann bei der Installation den oben genannten Error erhält, dann liegt das daran, dass im setup.exe.config File ein Eintrag nachgebessert werden muss. Es steht vermutlich drin, muss aber von Server auf Foundation geändert werden, also so aussehen: . Installation nochmals starten und es müsste funktionieren.

If you are installing your controls/features with the Sharepoint setup tool, then it can happen that you receive the above mentioned error. The error is caused, because the setup.exe.config has a false entry. It seem you have the following node in your config file . You need to change that from server to foundation, that means your node has to look like that: . Restart your installation and it should work.

Mittwoch, 31. März 2010

Sharepoint Items.Count, Count

Folgenden Fehler hatten wir heute bei der Programmierung eines Jobs, welcher vom Sharepoint Timer Dienst ausgelöst wird. Es wurde gegen Sharepoint programmiert, dabei eine Liste ausgelesen. Der Rückgabewert hatte im Debugmodus items = 2 und items.Count = null oder 0. D.h. eigentlich hat er über die Query etwas gefunden, man kann aber nicht iterieren, da nichts angezeigt wird. Folgender Fehler steckt hinter diesem Zustand. PERMISSIONS! In dem obigen Fall hatte der User nicht genügend Berechtigungen und da nützt es nichts den Code mit RunWithElevatedPrivilages laufen zu lassen. In die Liste gehen, dort dem User die nötigen Berechtigungen geben und es läuft. Sharepoint nutzt den System Account wenn mit dem Timer Dienst operiert wird. D.h. man sollte diesem "Nutzer" die korrekten Berechtigungen auf die Liste geben. Normalerweise würde man erwarten, dass man keinen Rückgabewert erhält, wenn Berechtigungen fehlen, aber es scheint, dass es immer einen Rückgabewert gibt, nur einmal ist er nicht aufrufbar.

The following error showed up today, while working on developing a job, that was supposed to be called from the Sharepoint Timer service. We developed against Sharepoint, in reading out a list. The return value of the code in the debug mode was items = 2, items.count = null oder 0. That means that the query worked and it found something, but you could not iterate through the result. Following error was the reason. PERMISSIONS! In our case the user did not have the correct permissions and to RunWithEvelatedPrivilages does not help either. You need to go to the list and give the user the correct permissions. You should be aware that a system account is used to run the Timer service. That means give the user the right permissions on the list. Usually you would expect, that it does not return any value, when you don't have the right permissions, but it seems, there is always a return value. When having not the correct permissions you can't access it.

Freitag, 19. März 2010

Guid im webpart

In einem Webpart muss man eine Guid angeben, jedoch, welche soll das sein. Hierzu einfach die Applikation erstellen und versuchen zu veröffentlichen und schon zeigt einem die Fehlermeldung den Guid an, welchen man verwenden sollte.

When creating a new webpart you are supposed to insert a guid into some files. But which one should you insert? Therefore just build and deploy your webpart and the error message will display a guid, that you should use.

Cannot import webpart

Bin gerade an meinen ersten Versuchen mit Sharepoint 2010. Eine neue Instanz und eigene Sitecollections erstellt. Um sich mit den Listen vertraut zu machen wollte ich ein Visual Webpart erstellen und dort ein wenig probieren. Doch das erstellen eines Webparts mit Visual Studio 2010 RC und dem Deployment auf Sharepoint 2010 war nicht so einfach wie ich dachte. Zwar ist das Deployment generel einfacher wie Sharepoint 2007, jedoch gibt es noch ein paar kleine "Bugs". Ein Fehler, welcher mich Stunden gekostet hat war "Cannot import webpart". In einem Blog habe ich ein Vorgehen entdeckt, wie man herausfinden kann, was an einem Webpart fehlerhaft ist, da die Exceptions in Sharepoint nicht gerade aussagekräftig ist.
1. Site actions -> Site settings -> Galleries -> Webparts
Dort muss das Webpart enthalten sein, ist es das nicht, besteht bereits der
Fehler beim Deployment.
2. Wenn man in der Gallery das Webpart direkt anklickt, müsste es sichtbar sein.
Jetzt kann es sein, dass bei Punkt 2 schon eine Fehlermeldung erscheint. Bei mir hat VS 2010 einfach Probleme mit der Versionierung. Hierzu folgendes beachten:
- Feature1.Template.xml, hier muss die Version und Guid die gleiche sein wie in
der AssemblyInfo.cs (.vb)
- [Name].webpart. In dieser Datei befindet sich unter type ein Placeholder,
welcher von VS generiert wird. Am besten diesen ersetzen durch statische
Werte (bei mir wurde hier immer die falsche Version generiert).
$SharePoint.Project.AssemblyFullName$ ersetzen durch ->
[Assemblyname], Version=[meine aktuelle Version], Culture=neutral
When Feature, Webpart und AssemblyInfo Datei die gleiche Version und Id haben, dann einfach Deployment erneut durchführen und manuell nochmals AppPool und IIS neu starten.
Im GAC (Windows -> assemblies) anschliessend nachsehen ob die Assembly kopiert wurde und die richtige Version hat. Im web.config der Sharepoint Webapplikation sollte die Assembly noch registriert sein.

Wenn alle diese Punkte beachtet wurden, sollte man zurück zu Punkt 2 und nochmals in der Webpart Gallery nachsehen, ob man das Webpart darstellen kann. Wenn ja, dann müsste es auch möglich sein das Webpart in der Seite einzufügen.


I am currently doing my first steps in Sharepoint 2010. Installed a new instance and created a site-collection. To get in touch with the lists and different actions, I created a visual webpart and wanted to play around in the code-behind.
But the creation of the webpart with VS 2010 RC and the deployment to Sharepoint 2010 was not that easy as I thought. Although deployment is now easier then Sharepoint 2007, still there seem to be some little "bugs". One error that required hours of bug fixing was "cannot import webpart". In a blog I found a very good introduction with steps to follow, when errors like that happen, because Sharepoint does not throw informative exceptions.
1. site actions -> site settings -> galleries -> webparts
There the webpart must be listed, when you deployed correctly. If it is not
listed, then something went wrong with deployment.
2. When clicking the webpart in the gallery, then the webpart is supposed to
display it's content. Now it is possible, that you already have an error now.
In my case VS 2010 had problems with the different versions. You should consider the following things:
- Feature1.Template.xml, here you need to have the same version as in the
AssemblyInfo.cs (.vb)
- [Name].webpart. In this file you have a placeholder, where VS generates the
version and some other things (in my case a wrong version has been generated).
$SharePoint.Project.AssemblyFullName$ replace with ->
[Assembly-name], Version=[your current version], Culture=neutral
When feature, webpart and assemblyinfo files do have the same version and Id, then deploy again and restart the application pool and iis manually.
In the global assembly cache (Windows -> assemblies) you should check if the assembly was deployed and if it has the correct version number. In the web.config of your sharepoint web-application this assembly is supposed to be registered as well.

When you checked all those things, then go back to number 2 and check once again if you can display the webpart in the gallery. If it is so, then you might be able to insert the webpart to your page.

Donnerstag, 4. März 2010

Going Sharepoint

Seit dem 1. März arbeite ich als Software Engineer bei der 4 Screen in Luzern. Meine neue Aufgabe und Herausforderung dort wird Sharepoint 2010 sein. Aus diesem Grund werde ich vermehrt in Zukunft Sachen zum Thema Sharepoint posten. Meine ersten Schritte, Fehler, etc.
Since March 1st I am working as a software engineer at 4 Screen in Lucerne. My new job and challange in future will be Sharepoint 2010. That will be the reason, why I will post more about Sharepoint in future. To leave some facts about my first steps, errors, etc.

Donnerstag, 10. Dezember 2009

Clientseitige XML Datenbank - client-side XML db

Was ich im Moment versuche ist, eine Art clientseitige Datenbank zu erstellen. Das Prinzip ist folgendes, dass man in einem regulären XHTML Dokument versucht in einem hidden div Layer eine XML Struktur zu erstellen, die es erlaubt vom JavaScript aus über ein Objekt Daten in dieser Struktur zu erstellen und zu löschen. Auf diese Art und Weise benutzt man das Objekt als Schnittstelle zwischen den JavaScript Daten und der pseudo XML Datenbank in der Webseite. Anschliessend werden diese Daten als XML in eine hidden Textbox generiert. Von dort kann sie .NET auslesen und weiterverarbeiten. Mein Ziel ist es, das ganze so generisch wie möglich zu halten um es auch wiederverwenden zu können. Wenn jemand weitere Ideen hat, lasst es mich wissen.

What I am trying at the moment is to create something like a client-based database. The logic behind that is, that you try to store in a general XHMTL document a XML structure. This happens basicaly in a hidden div layer. Then you are able to store values in this structure and delete them as well. I want to add to this an object, that works like an interface between the XML db and the JavaScript code. Afterwards this data is generated into a hidden text-box, from where .NET can pick it up to work with the data. My goal is, to keep everything very generic, so it can be re-used. Any further ideas, let me know.

Mittwoch, 21. Oktober 2009

Vorsicht - Attention

Vorsicht zu dem Beitrag zuvor. Wenn man dann Werte ausliest aus dem HiddenField, sollte man bzgl. SQL injection oder codegefährdeten Elementen die Werte validieren. Denn im Grunde wäre es ein sehr leichtes, Werte abzuändern und damit Schaden zu verursachen. Ist eine gute Methode, aber mit Vorsicht zu geniessen, wie alles was mit JavaScript zu tun hat.

Attention to the post before. When reading out values from the HiddenField, you should be aware of sql injection or code harming elements. That means validate the values read out. Basically it would be very easy to manipulate the values and harm your application. The described method is a good one, but take care, like you always should, when working with javascript.

Dienstag, 13. Oktober 2009

Javascript & .NET

Dieser Post ist nur ein kleiner Tipp, für alle, die sich mit Javascript Cookies schwer tun und gerne Javascript mit .Net Technologie verbinden. I hatte die Aufgabe in einer Applikation im Front-End viel Javascript zu verwenden und es anschliessend im Back-End zu verarbeiten und das über mehrere Postbacks. Meine Lösung war, Werte des Javascripts in einem .Net hidden-field zu speichern, dann über .Net auszulesen und weiterzuverarbeiten, sei es in einer Session, bzw. Datenbank. Somit erreicht man viel clientseitige Funktionalität ohne .Net Postbacks, mit .Net Vorzügen bei einem Postback.

This post is just a little hint for all people, who find javascript cookie handling hard to do and would like to combine it with .Net technology. My job was to include into the front-end a lot of javascript and then working with it in the back-end through multiple post-backs. My solution was, to store the javascript values in a .Net hidden-field and then to read it out through the .Net technology to proceed in storing in a database or session. The pro of this way is, that you have a lot of client-side functionality without .Net post-backs, with the advantage of .Net when performing a post-back.

Umbraco certified


Nachdem ich jetzt 3 Jahre mit Umbraco arbeite und schon den Level 2 Kurs besuchte, habe ich die Zertifizierung gemacht und darf mich ab nun "Umbraco Certified Professional" nennen. Zertifizierung beinhaltete Level 1 und 2.
After working with Umbraco for 3 years and participating in the level 2 course, I decided to do the certification and can call myself now an "Umbraco Certified Professional". My certification was level 1 and 2.