Question

J'ai un modèle BCS assez simple:

public Guid Id { get; set; }
public SPFieldUrlValue Url { get; set; }
public string Description { get; set; }
public string Owner { get; set; }
public DateTime CreatedOn { get; set; }

La propriété URL contient à la fois le titre et l'URL comme toute propriété Hyperlink SharePoint. Le modèle BCS a le type suivant descripteur pour les deux méthodes Readlist et ReadItem:

<TypeDescriptor Name="Url" TypeName="Microsoft.SharePoint.SPFieldUrlValue">
    <Properties>
        <Property Name="SPCustomFieldType" Type="System.String">`URL</Property>
    </Properties>
</TypeDescriptor>

Dans la schema.xml de définition de liste Je les valeurs suivantes pour la collection Fields:

<Field Name="BdcIdentity" DisplayName="BDC Identity" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="BdcIdentity" Type="Text" />
<Field Name="Id" DisplayName="Id" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Id" Type="Text" />
<Field Name="Url" DisplayName="Url" Format="Hyperlink" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Url" Type="URL" />
<Field Name="Description" DisplayName="Description" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Description" Type="Text" />
<Field Name="Owner" DisplayName="Owner" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Owner" Type="Text" />
<Field Name="CreatedOn" DisplayName="Created On" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="CreatedOn" Type="DateTime" />

Rien d'extraordinaire. Quand j'ouvre la vue par défaut, cependant, il ne montre pas l'URL correctement dans la vue de la table - il affiche rien. Dans l'élément individuel voir qu'il fait afficher correctement. Toute réflexion sur la façon d'obtenir un SPFielidUrlValue pour rendre correctement sur l'interface utilisateur?

Était-ce utile?

La solution

Après deux mois et demi (!!!!) PSS a pu trouver une solution à l'aide d'une feuille de style XML personnalisé qui est stocké dans layouts / xsl:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:template match="FieldRef[@Name='Url' and @Format='Hyperlink']" mode="URL_body" priority="1">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="url" select="normalize-space(substring-before($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="desc" select="normalize-space(substring-after($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="descfld" select="$thisNode/@Description"/>
    <xsl:variable name="urlfld" select="$thisNode/@Url"/>
    <!--  URL: <xsl:value-of select="$urlfld" /><br/>
          Description: <xsl:value-of select="$descfld" /><br/>
      Link: -->
    <a href="{$url}" alt="{$desc}">
      <xsl:value-of select="$desc"/>
    </a>
  </xsl:template>
</xsl:stylesheet>

Autres conseils

Selon la page MSDN BDC Propriétés personnalisées :

Cette propriété n'a pas d'effet sur les méthodes autres que le SpecificFinder.

Je me demande, comment puis-je mettre en œuvre cette xsl? Biensur je peux créer et déployer dans layouts / xsl ... Mais il n'y a aucun lien entre la liste externe et le fichier xsl?

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top