Freitag, 14. Mai 2010

Search core results XSLT Sharepoint

Das Webpart search core results ist ziemlich eindrucksvoll, vor allem, da man wirklich einfach Resultate anzeigen kann. Wenn man gerne die Total Results zeigen will, kann man im XSLT folgende Variable eingeben und verwenden:
<xsl:variable name="Rows" select="/All_Results/Result" />
<xsl:variable name="RowCount" select="count($Rows)" />
<xsl:value-of select="$RowCount" />


Anbei noch eine Darstellung des Search Result XML:
<All_Results>
<Result>
<id>1</id>
<rank>713</rank>
<title>Microsoft.SharePoint Namespace</title>
<author />
<size>39058</size>
<url>http://msdn.microsoft.com/library/default.asp?url=/library/en- us/spptsdk/html/tsnsMicrosoftSharePoint_SV01017995.asp</url>
<description>Microsoft.SharePoint Namespace</description>
<sitename> http://msdn.microsoft.com/library</sitename>
<collapsingstatus>0</collapsingstatus>
<hithighlightedsummary>
<…>
</hithighlightedsummary>
<hithighlightedproperties>
<…>
</hithighlightedproperties>
<…>
</Result>
<Result>
<…>
<…>
</Result>
</All_Results>


The webpart called search core results is very impressive, especially, when you want to display results simply. If you want to display the total results, then you can use this code in your XSLT file:
<xsl:variable name="Rows" select="/All_Results/Result" />
<xsl:variable name="RowCount" select="count($Rows)" />
<xsl:value-of select="$RowCount" />


Here is the structure of the search-result XML:
<All_Results>
<Result>
<id>1</id>
<rank>713</rank>
<title>Microsoft.SharePoint Namespace</title>
<author />
<size>39058</size>
<url>http://msdn.microsoft.com/library/default.asp?url=/library/en- us/spptsdk/html/tsnsMicrosoftSharePoint_SV01017995.asp</url>
<description>Microsoft.SharePoint Namespace</description>
<sitename> http://msdn.microsoft.com/library</sitename>
<collapsingstatus>0</collapsingstatus>
<hithighlightedsummary>
<…>
</hithighlightedsummary>
<hithighlightedproperties>
<…>
</hithighlightedproperties>
<…>
</Result>
<Result>
<…>
<…>
</Result>
</All_Results>

Mittwoch, 12. Mai 2010

Webpart - default ohne Chrome.

Wer sein Webpart deployen will und beim Insert in die Seite dann gerne den Chrome Defaultwert "none", also ohne Chrome hätte, muss in die vom Webpart geerbte Klasse folgende Methode anfügen:
PartChromeType chromeType = PartChromeType.None;
public override PartChromeType ChromeType
{
get
{
return chromeType;
}
set
{
chromeType = value;
base.ChromeType = value;
}
}


Who wants to deploy his webpart and have the chrome set default to "none", needs to insert a method into his webpart inherited class:
PartChromeType chromeType = PartChromeType.None;
public override PartChromeType ChromeType
{
get
{
return chromeType;
}
set
{
chromeType = value;
base.ChromeType = value;
}
}

Access denied by Business Data Connectivity

Diese Fehlermeldung in Sharepoint 2010 im Bereich External Lists BDC bedeutet, dass die Berechtigungen nicht richtig gesetzt sind. Eine gute Erklärung gibt es hier. Nicht vergessen bei den Usern den "Add" Button zu betätigen umd diese User auch in das unten liegende Textfeld zu übernehmen.
http://blog.libinuko.com/2010/04/11/sharepoint-2010-howto-configure-business-data-connectivity-access-rights/

This error-message in Sharepoint 2010, when working with external-lists, means, that the permissions are not set correctly. A good description gives you the following website. Don't forget to use the "Add" button, when having some user chosen, so the user are applied to the text-box below.
http://blog.libinuko.com/2010/04/11/sharepoint-2010-howto-configure-business-data-connectivity-access-rights/

Visual Studio 2010 BDC - Add Solution Deployment crashed

Wenn man ein BDC Projekt in Visual Studio 2010 erstellt, dieses deployen will und folgende Fehlermeldung erhält:
The BDC Service application Business Data Connectivity Service is not accessible. The full exception text is: The HTTP service located at xy.svc/http is too busy.
Dann einfach den Application Pool mit einem guidähnlichen Namen neu starten. Ist auch einer der Application Pools, welcher vom Serviceaccount-Nutzer verwaltet wird. Wenn man nicht weiss, welcher genau, dann sollte man alle nochmals starten.

When trying to deploy a BDC project in Visual Studio 2010 and you receive the following error-message:
The BDC Service application Business Data Connectivity Service is not accessible. The full exception text is: The HTTP service located at xy.svc/http is too busy.
Then you should restart the application-pool with the guid-stlye name. Is supposed to be one of the app-pools, that is administered by a service-account-user. If you are not sure, which one, you can also restart all of them.

Dienstag, 11. Mai 2010

Sharepoint 2010 sign in - The operation has timed out

Heute morgen hatte ich das Problem, dass ich eine Sharepoint 2010 Page öffnen konnte, aber dann beim Sign in die Fehlermeldung - The operation has timed out - erhalten habe. Man konnte weder über Windows Auth noch über FBA einloggen. Event-viewer gab folgende Fehlermeldung aus:
Source: SharePoint Foundation
Event ID: 8306
Level: Error
Task Category: Claims Authentication
Ein simpler Neustart des SecurityTokenServiceApplicationPool - Application-pools hat gereicht, dass es wieder läuft.

This morning I had the problem, that I could open a Sharepoint 2010 page, but when trying to sign in, I received the error - The operation has timed out. I was unable to login neither Windows nor FB-authentication. In the event-viewer, I had the following error information:
Source: SharePoint Foundation
Event ID: 8306
Level: Error
Task Category: Claims Authentication
A simple restart of the SecurityTokenServiceApplicationPool - application-pool was enough to make it working again.

Montag, 10. Mai 2010

Error occurred in deployment step 'Recycle IIS Application Pool': 0x80070005Access deniied

In dem Fall reicht es bei Sharepoint nicht aus, dass man Farmadmin und Siteadmin ist, man muss auch Owner sein, damit man über Visual Studio 2010 das Deployment ausführen kann. Überprüfe die Berechtigungen.

In this case it is not enough in Sharepoint to be farm-admin and site-admin. You need to be owner, to be able to deploy out of Visual Studio 2010. Check your permissions.

Donnerstag, 6. Mai 2010

The request failed with HTTP status 405: Method not allowed - Webservice

Ich hatte vor ein paar Tagen einen Webservice in mein Projekt integriert. Dabei von einem Drittanbieter den Webservice als Webreference eingetragen, dazu die wsdl Adresse verwendet. Jedoch kam beim Testen einiger Methoden immer folgender Fehler: " The request failed with HTTP status 405: Method not allowed ". Im Internet habe ich nicht viel gefunden, ausser, dass man Einstellungen an der machine.config vornehmen sollte. Die Lösung war dann doch trivialer. Ich habe die wsdl Adresse im Browser aufgerufen. Dort im unteren Bereich die zuständige asmx Adresse gefunden. Die Url der Webservice Referenz überschrieben mit der asmx Url und schon hat es funktioniert. Resultat, wsdl ruft das Schema auf, asmx führt die Methode aus.
- überschreiben der Url heisst, die Klasse, welche ich aufgerufen habe über den Webservice, hatte eine Property mit Url, dort die asmx Adresse eingegeben und anschliessend den Request ausgeführt -
!Immer aufpassen ob es sich um http oder https handelt!

A few days ago, I integrated a third party web-service into my project. Therefore I created a web-reference and added the wsdl address of the web-service. When testing some calls to the methods of this service, I received the following error: " The request failed with HTTP status 405: Method not allowed ". On the internet I just found articles about changes in the machine.config. The solution was more trivial. I looked at the wsdl address in the browser and in the bottom part I found the asmx address for the web-service. I overwrote the property of the web-service reference and it worked. Result, wsdl calls the schema and asmx performs the methods.
- overwriting of the url means, that the class I called through the web-service, had a property called Url, and there I passed the asmx address und after that I performed the request -
!Always check if it is a http or https address!

Montag, 3. Mai 2010

Webservice certificate invalid

Ich hatte folgendes Problem. Beim Aufrufen eines Webservice, bekam ich folgenden Error:
The remote certificate is invalid according to the validation procedure
Dieser besagt, dass das Zertifikat, welches benutzt wird anscheinend nicht gültig ist. Damit man diesen Fehler ignorieren kann, vor dem Aufruf und der Arbeit mit dem Webservice folgenden Code einfügen:
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

// add this to your code before you make your web service call.
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslError)
{
bool validationResult = true;
return validationResult;
};


I had the following problem. When calling a webservice I received this error:
The remote certificate is invalid according to the validation procedure
This error means, that the certificate of the requested page is not valid. To ignore this error, you have to add the following code, before working and calling with the webservice:
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

// add this to your code before you make your web service call.
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslError)
{
bool validationResult = true;
return validationResult;
};