惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - Gu-dong

Coding道场:第一次 人工智能与3A 敏捷中的自组织团队 历史总是螺旋上升的 一个成功敏捷团队的失败历程 敏捷书籍推荐列表 最近一个项目的一点反省:客户价值才是关注的焦点 Scrum vs. PMP vs. PRINCE2的发展趋势图 敏捷团队谁负责? 什么是产品的愿景—从一篇博文中学得到 全栈开发与敏捷 VS2005以后的MFC如何修改菜单的颜色 我对敏捷的理解:实施敏捷的前提 华为EC169 3G卡在Win7下的安装 推荐一个非常优秀的SharePoint Tag Cloud Webpart 王晓阳的搜狐博客被封了 也谈谈丰田事件 重建SharePoint Service 2.0的全过程 “用户体验”——微软Tech ED2009大会有感
如何在SharePoint Blog中显示附件(Attachement file)
Gu-dong · 2010-05-13 · via 博客园 - Gu-dong

参考了一个博客(http://www.pampigt.se/?p=69),其中自己也下了不少功夫,主要是对SharePoint Designer中Data view的使用方法不熟悉,走了些弯路,但终于还是搞定了。贡献给大家,应该也算是个原创吧。

1. 在NewPost画面增加Attach File按钮。

  • 修改文件:C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates\Blog\Lists\Posts\schema.xml。
    将以下内容

    代码

    <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>

    修改为:

    代码

    <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>

    这样在NewPost画面,就可以显示“Attach File”,并可以上传文件。
  • 修改Post.aspx的View,显示附件。
    打开Post.aspx,编辑该页面。在当前的View中,选择现实Attachments。这时,只会显示一个附件的图标,表示是否有附件,但是文件的链接不能显示。

2. 修改Post.aspx,显示附件的链接。

  • 用SharePoint Designer 2007,打开Post.aspx。
  • 选中Post Webpart(它应该是显示There are no posts in this categray.),点击右键执行“Covert to XSLT data view”。
    转换后会有一个错误,发生在以下语句:
    <xsl:when test="=@Author">
    改为以下即可。
    <xsl:when test="@Author">
  • 转换完成后,点击菜单:Data View->Parameters...。增加一个新的Parameter。如下图:

  • 点击菜单:Data View->Filter...。增加一个新的Filter。如下图:

  • 编辑Post.aspx的最新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>

  • 修改为:

    代码

    <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>

     注意:ListId要替换为自己网站内的ListId。

  • 保存Post.aspx。

至此,大功告成。重新在IE下打开Post.aspx,将会看到原来附件图标不见了,取而代之的是附件的链接。有多个附件时,将以多行显示。