Pregunta

He creado un tipo de contenido externo a través del diseñador de SharePoint. Uno de los campos que estoy obteniendo de mi base de datos es una columna de fecha y hora. En SharePoint, sin embargo, quiero formatear esto solo como una fecha. Por el momento se avanza como

2011-05-06 00: 00: 00z

Quiero algo como:

2011-05-06

O idealmente:

06-05-2011

Suena realmente simple, pero puedo encontrar poca información sobre cómo lograr esto. ¿Me he perdido algo realmente obvio? ¿Es esto alcanzable? No quiero tener que modificar la base de datos (que llevará tiempo y administración)

Editar: el problema particular es una columna de fecha dentro del selector de datos externo, y el tipo de contenido externo solo se usa para una columna de datos externo.

¿Fue útil?

Solución 3

It doesn't appear that this is possible at this time, which is annoying. Kudos for Roel for his tip on doing this for an External List.

Otros consejos

There is an article in the DUET info on MSDN that shows you how to do this: http://msdn.microsoft.com/en-us/library/gg271157.aspx

I think you can do it as follows as well (since an external content type is still a content type; however I have not tested this): - Create your external list from the external content type - Go into the external lists you have created for your site in sharepoint designer - In the right hand corner you can see the views. Your external list should have a default view. Click on it and the file should open in sharepoint designer.

Look for a snippet like this:

<XmlDefinition>
            <View Name="{62A0ABCF-DF9D-45DD-985E-46ECDC9F5004}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="SmartAppList" Url="/Lists/ghjghj/ReadList.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png">
                <Method Name="ReadList"/>
                <Query>
                    <OrderBy>
                        <FieldRef Name="Id"/>
                    </OrderBy>
                </Query>
                <ViewFields>
                    <FieldRef Name="Id" ListItemMenu="TRUE" LinkToItem="TRUE"/>
                    <FieldRef Name="Name"/>
                    <FieldRef Name="Description"/>
                    <FieldRef Name="ConfigurationXml"/>
                </ViewFields>
                <RowLimit Paged="TRUE">30</RowLimit>
                <Aggregations Value="Off"/>
                <Toolbar Type="Standard"/>
            </View>
        </XmlDefinition

>

  • At the fieldref for your field you should be able to add the format attribute. This allows you to change the display of the date/time field.

Refer to http://msdn.microsoft.com/en-us/library/aa543225.aspx for possible values.

From SharePoint designer:

  • List and Libraries -> Click on list -> Under Views tab -> Read List
  • Right click on the date field -> Edit formula

    Replace:

    $thisNode/@*[name()=current()/@Name]

    With

    substring-before($thisNode/@*[name()=current()/@Name], ' ')

  • Licenciado bajo: CC-BY-SA con atribución
    scroll top