深入探究 SharePoint 2013 服务器端解决方案开发
功能升级
在 SharePoint 开发中,功能升级是一个重要的环节。下面是一段 C# 代码,用于枚举功能实例并调用升级方法:
// enumerate through feature instances and call Upgrade
foreach (SPFeature feature in features) {
feature.Upgrade(true);
}
不过,这段来自控制台应用程序的 C# 代码虽然易于阅读和理解,但在生产环境中并不是升级功能实例的实用方法。更明智的做法是将等效代码添加到 Windows PowerShell 脚本中。以下是一个用于升级 http://wingtiptoys 网站应用程序中所有功能实例的 Windows PowerShell 脚本:
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction "SilentlyContinue"
$WebAppUrl = "http://wingtiptoys"
$featureId = New-Object System.Guid
-ArgumentList "593228ab-7fcd-4a81-a4b8-ea77b2cbe1cc"
$webApp = Get-SPWebApplication $WebAppUrl
深入探究SharePoint 2013沙盒解决方案开发
超级会员免费看
订阅专栏 解锁全文
71

被折叠的 条评论
为什么被折叠?



