I have a text file in module and I need to copy that file to a document library that is not existed yet, and it is going to be created in featureActivated. What should I do in this situation?
Deploy to an existing library and then calling MoveTo in event receiver.
Sample demo:
<?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");
}