How to display attachments in A SharePoint blog (attachement file)

Source: Internet
Author: User

Refer to a blog (http://www.pampigt.se /? P = 69). I also made a lot of effort, mainly because I was not familiar with the use of data view in SharePoint designer and took some detours, but I finally got it done. It should be an original article.

1. Add the Attach file button on the newpost screen.

  • Modify the file: C: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ sitetemplates \ blog \ lists \ posts \ schema. xml.
    Set the following content Code

    < Forms >
      < Form Type = "Displayform" URL = "Viewpost. aspx" Webpartzoneid = "Main"   />
      < Form Type = "Editform" URL = "Editpost. aspx" Toolbartemplate = "Blogeditformtoolbar" Template = "Blogform" Webpartzoneid = "Main"   />
      < Form Type = "Newform" URL = "Newpost. aspx" Toolbartemplate = "Blognewformtoolbar" Template = "Blogform" Webpartzoneid = "Main"   />
    </ Forms >

     

    To:Code

    < Forms >
      < Form Type = "Displayform" URL = "Viewpost. aspx" Webpartzoneid = "Main"   />
      < Form Type = "Editform" URL = "Editpost. aspx" Webpartzoneid = "Main"   />
      < Form Type = "Newform" URL = "Newpost. aspx" Webpartzoneid = "Main"   />
    </ Forms >

     

    In this way, the newpost screen displays "Attach file" and can upload files.

  • Modify the view of post. aspx to display the attachment.
    Open post. aspx and edit the page. Select attachments in the current view. At this time, only one attachment icon is displayed, indicating whether there are attachments, but the file link cannot be displayed.

2. Modify post. aspx to display the attachment link.

  • Open post. aspx with SharePoint designer 2007.
  • Select post webpart (it should display there are no posts in this categray.), right-click and execute "covert to XSLT Data View ".
    An error occurs after conversion in the following statement:
    <XSL: When test = "= @ Author">
    Change to the following.
    <XSL: When test = "@ Author">
  • After the conversion, click Data View> parameters .... Add a new parameter. For example:
  • Click Data View> filter .... Add a new filter. For example:
  • Edit the latest code of post. aspx. Find the following Code : Code

    < XSL: When Test = "@ Attachments = ''" > </ XSL: When >
    < XSL: otherwise > Attachments:
    < XSL: If Test = "Not (@ attachments = 0 )" > < IMG Border = "0" SRC = "{$ Httpvdir}/_ layouts/images/attach.gif"   />
    </ XSL: If >
    </ XSL: otherwise >
  •  

    To:Code

    < XSL: When Test = "@ Attachments = ''" > </ XSL: When >
    < XSL: otherwise > Attachments:
    < XSL: If Test = "Not (@ attachments = 0 )" >
    < XSL: Element Name = "SharePoint: attachmentsfield" >
    < XSL: attribute Name = "Runat" > Server </ XSL: attribute >
    < XSL: attribute Name = "Listid" > {AC915FEE-C3BE-4102-8D84-75A384A327A2} </ XSL: attribute >
    < XSL: attribute Name = "Fieldname" > Attachments </ XSL: attribute >
    < XSL: attribute Name = "ControlMode" > Display </ XSL: attribute >
    < XSL: attribute Name = "Visible" > True </ XSL: attribute >
    </ XSL: Element >
    </ XSL: If >
    </ XSL: otherwise >

    Note: Replace the listid with the listid of your website.

  • Save post. aspx.

So far, the success is achieved. Re-open post. aspx under IE and you will see that the original attachment icon is missing and replaced by the attachment link. Multiple attachments are displayed in multiple rows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.