この方法で行うことができます 1) プロジェクトの sharepoint プロジェクトにフィーチャーを追加します 2) イベント レシーバーを追加します。feature.cs ファイルに XML ファイルを作成できます
public class Feature1EventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
// Get the Context
SPSite Site = (SPSite)properties.Feature.Parent;
//Get the Web Address
SPWeb Web = Site.OpenWeb();
//Create a Path to Microsoft Shared/14
//string serverPath = SPUtility.GetGenericSetupPath(string.Empty);
string serverPath = "C:\\inetpub\\wwwroot\\wss\\VirtualDirectories\\38118\\config";
// Changes yhe folder permission to the grant access to all chat users
FolderACL(serverPath);
//Create the Congig file
CreateConfigFile(serverPath);
}
/// <summary>
/// Changes yhe folder permission to the grant access to all chat users
/// </summary>
/// <param name="path"></param>
public static void FolderACL(String path)
{
DirectorySecurity Psec = Directory.GetAccessControl(path);
SecurityIdentifier Peveryone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
Psec.AddAccessRule(new FileSystemAccessRule(Peveryone, FileSystemRights.Modify | FileSystemRights.Synchronize, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
Directory.SetAccessControl(path, Psec);
}
/// <summary>
/// Method which Created the Config file
/// </summary>
/// <param name="path"></param>
public static void CreateConfigFile(String path)
{
//Use an xml Writer
using (XmlWriter writer = XmlWriter.Create(path + "/Config.xml"))
{
//Start the Xml Document
writer.WriteStartDocument();
//Create Root element
writer.WriteStartElement("Root");
//Write Element in the root element
writer.WriteElementString("element", "abcd");
writer.WriteElementString("element", "efgh");
//End the root element
writer.WriteEndElement();
//End the Xml Document
writer.WriteEndDocument();
}
}