![](/img/trans.png)
[英]How to check size of library document file before uploaded with event receiver
[英]How to copy a text file from a module to a document library that is not created, in SharePoint event receiver?
我在模塊中有一個文本文件,我需要將該文件復制到一個尚不存在的文檔庫中,它將在 featureActivated 中創建。 在這種情況下我該怎么辦?
部署到現有庫,然后在事件接收器中調用 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");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.