[SPS2010] 利用Feature 推送文件

本文介绍如何使用SharePoint Feature Solution批量推送文件到SharePoint 2010的文档库中。通过创建特定的XML配置文件及CMD命令行,实现文件的高效部署。

 

有时侯需要批量拷贝一些文件到sharepoint 2010的档案库,sharepoint feature solution 可以简单的完成

 

例如要把 hi.docx,sample.txt 拷贝到 hiweb.contoso.com 和 intranet.contoso.com 下的 shared documents.

 

如下步骤:

 

在 SPS2010 的系统路径的 features 下 新开一个文件夹 filepush

生成一个 feature.xml 文件, 内容如下

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Id="524ED45F-C546-462D-A85F-34E8CC5CF5CC" Title="Demo.20100824" Scope="Web">
                 <ElementManifests>
                          <ElementManifest Location="elements.xml" />
                  </ElementManifests>
  </Feature>

 

再生成一个 elements.xml 文件, 内容如下

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Deploy" Url="Shared Documents">
        <File Url="Sample.txt" Type="GhostableInLibrary" />
        <File Url="Hi.docx" Type="GhostableInLibrary" />
    </Module>
</Elements>

然后再把hi.docx和sample.txt拷贝进来。

image

生成一个命令行文件 push.cmd, 内容如下

stsadm -o uninstallfeature -n filepush -force
stsadm -o installfeature -n filepush
stsadm" -o activatefeature -n filepush -url "http://intranet.contoso.com/" –force

stsadm" -o activatefeature -n filepush -url http://hiweb.contoso.com/ -force

 

结果

image

 

注意如果同名文件已经存在,推送会失败,也就是同名文件不会被替换。

posted on 2010-08-31 11:36 by1455 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/by1455/archive/2010/08/31/1813503.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值