我在模块中有一个文本文件,我需要将该文件复制到一个尚不存在的文档库中,它将在 featureActivated 中创建。在这种情况下我该怎么办?
问问题
42 次
1 回答
1
部署到现有库,然后在事件接收器中调用 MoveTo。
示例演示:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MyModule" Url="MyDOc">
<File Path="MyModule\Sample.txt" Url="Sample.txt" Type="GhostableInLibrary"/>
</Module>
</Elements>
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPFile file = site.OpenWeb().GetFile("MyDOc/Sample.txt");
file.MoveTo("/Shared%20Documents/Sample.txt");
}
于 2019-11-01T07:47:13.037 回答