从 WSS 中提取解决方案文件

发布于 2024-07-14 19:21:18 字数 66 浏览 4 评论 0原文

我试图弄清楚如何从 SharePoint 服务器中提取解决方案文件 .wsp 文件。 这可能吗?如果可能的话怎么办?

I'm trying to figure out how to extract a solution file .wsp file from a SharePoint server. Is this possible and if so how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜柠檬 2024-07-21 19:21:18

您可以创建一个小型控制台应用程序并使用 SPFarm.Local.Solutions 属性访问解决方案。 包含 Microsoft.SharePoint.Administration 命名空间并使用以下代码片段下载解决方案文件:

SPSolutionCollection solutions = SPFarm.Local.Solutions;

foreach (SPSolution solution in solutions)
{
    SPPersistedFile wspFile = solution.SolutionFile;
    wspFile.SaveAs("c:\\Temp\\Solutions\\" + solution.Name);
}

在调用 SaveAs() 方法之前,您需要确保输出目录存在。 如果不存在,则会抛出异常。

You can make a small console application and access the solutions using the SPFarm.Local.Solutions property. Include the Microsoft.SharePoint.Administration namespace and use the following code snippet to download the solution file:

SPSolutionCollection solutions = SPFarm.Local.Solutions;

foreach (SPSolution solution in solutions)
{
    SPPersistedFile wspFile = solution.SolutionFile;
    wspFile.SaveAs("c:\\Temp\\Solutions\\" + solution.Name);
}

You need to make sure that your output directory exists before calling the SaveAs() method. If it does not exists an exception is thrown.

抚你发端 2024-07-21 19:21:18

您可以使用 SPFarm 访问场上的解决方案本地 .解决方案属性。 我不确定您是否可以检索底层文件。 这就是我要开始的地方。

You can access the Solutions on a farm by using the SPFarm.Local.Solutions property. I'm not sure if you can retrieve the underlying file though. That's where I'd start.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文