Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint品牌-多文件资源调配_Sharepoint_Branding - Fatal编程技术网

Sharepoint品牌-多文件资源调配

Sharepoint品牌-多文件资源调配,sharepoint,branding,Sharepoint,Branding,我在sharepoint中创建了一个自定义母版页,其中包含大量图像(比如200)。如何打包要设置到网站集样式库的所有文件?我所知道的唯一方法是通过一个特性,但这意味着将每个文件(全部200个)作为元素列出。有没有更简单的方法?中的属性IncludeFolders=“??-??”似乎没有任何作用 如果所有图像文件都在“我的功能”文件夹中的文件夹中(例如…\template\features\MyFeatures\images),是否有办法将整个文件夹提供给样式库 谢谢。此module.xml文件位

我在sharepoint中创建了一个自定义母版页,其中包含大量图像(比如200)。如何打包要设置到网站集样式库的所有文件?我所知道的唯一方法是通过一个特性,但这意味着将每个文件(全部200个)作为
元素列出。有没有更简单的方法?
中的属性IncludeFolders=“??-??”似乎没有任何作用

如果所有图像文件都在“我的功能”文件夹中的文件夹中(例如…\template\features\MyFeatures\images),是否有办法将整个文件夹提供给样式库


谢谢。

此module.xml文件位于名为“Images”的文件夹中。所有图片也都在此文件夹中(使用sharepoint开发工具for visual studio 2008 v1.3)。wsp包需要知道正在添加的所有文件,因此您必须添加每个文件。(将.wsp重命名为.cab并将其打开。然后可以看到解决方案中的所有文件)


您可以编写一个小型C#应用程序为您创建xml文件,如下所示:

 var info = new DirectoryInfo(@"c:\pathToImageFolder");
        var files = info.GetFiles();

        TextWriter writer = new StreamWriter(@"c:\pathToImageFolder\module.xml");

        writer.WriteLine("<Elements Id=...");
        foreach (FileInfo file in files)
        {
            writer.WriteLine(string.Format("<File Path='{0}' Url='{0}' Type='GhostableInLibrary' />",file.Name));
        }
        writer.WriteLine("</Elements>");
        writer.Flush();
        writer.Close();
var info=newdirectoryinfo(@“c:\pathToImageFolder”);
var files=info.GetFiles();
TextWriter writer=newstreamwriter(@“c:\pathToImageFolder\module.xml”);

writer.WriteLine(这里有一个适用于我的快速Powershell函数:

function Enum-FilesInPath
{
    param([string]$path)

    Get-ChildItem -path $path | foreach-object {
        # if a directory, recurse...
        if ($_.PSIsContainer)
        {
            $recursivePath = [string]::Format("{0}\{1}", $path, $_.Name)
            Enum-FilesInPath $recursivePath
        }
        # else if a file, print out the xml for it
        else
        {
            $finalPath = [string]::Format("{0}\{1}", $path, $_.Name)
            $url = $finalPath.Replace("\", "/") # backslashes for path, forward slashes for urls
            [string]::Format("`t<File Url=`"$url`" Path=`"$fullPath`" Type=`"GhostableInLibrary`" />")
        }
    }
}
函数枚举文件输入路径
{
参数([string]$path)
Get ChildItem-path$path | foreach对象{
#如果是一个目录,递归。。。
如果($\ PSIsContainer)
{
$recursivePath=[string]::格式(“{0}\{1}”,$path,$\u.Name)
枚举文件输入路径$recursivePath
}
#否则,如果是一个文件,请打印它的xml
其他的
{
$finalPath=[string]::格式(“{0}\{1}”,$path,$\.Name)
$url=$finalPath.Replace(“\”,“/”)#路径用反斜杠,url用正斜杠
[字符串]::格式(“t”)
}
}
}

感谢您的回复。以编程方式动态创建modules.xml文件是一个很好的建议。我将尝试这样做。
function Enum-FilesInPath
{
    param([string]$path)

    Get-ChildItem -path $path | foreach-object {
        # if a directory, recurse...
        if ($_.PSIsContainer)
        {
            $recursivePath = [string]::Format("{0}\{1}", $path, $_.Name)
            Enum-FilesInPath $recursivePath
        }
        # else if a file, print out the xml for it
        else
        {
            $finalPath = [string]::Format("{0}\{1}", $path, $_.Name)
            $url = $finalPath.Replace("\", "/") # backslashes for path, forward slashes for urls
            [string]::Format("`t<File Url=`"$url`" Path=`"$fullPath`" Type=`"GhostableInLibrary`" />")
        }
    }
}