使用PowerShell创建使用BDC的SharePoint 2010搜索内容源
问题描述:
使用powershell如何创建使用BDC的内容追踪?使用PowerShell创建使用BDC的SharePoint 2010搜索内容源
Technet上关于New-SPEnterpriseSearchCrawlContentSource的文档不太清楚如何做到这一点。
到目前为止,这对我来说似乎最合理,但它不起作用。
$searchapp = Get-SPEnterpriseSearchServiceApplication "MySearchApplication"
New-SPEnterpriseSearchCrawlContentSource -name "My BDC Content Source" -searchapplication $searchApp -Type Business -LOBSystemSet "NameOfMyBdc"
它创建了Business Data Connectivity类型的内容源,但未检查指定的BDC。
答
浪费了很多时间在这个,但最终得到它的工作。这是对我有用的,如果你有更好的解决方案,请分享。
$searchapp = Get-SPEnterpriseSearchServiceApplication "My Search Service Application Name"
$lobSystems = @("LOBSystemName1","LOBSystemInstanceName1")
$proxyGroup = Get-SPServiceApplicationProxyGroup -default
New-SPEnterpriseSearchCrawlContentSource -name "My Content Source Name" -searchapplication $searchApp -Type Business -LOBSystemSet $lobSystems -BDCApplicationProxyGroup $proxyGroup
您也可以使用这样的API来做到这一点。我不知道ConstructStartAddress方法的Guid PartitionId参数是什么,但它似乎不适用于任何其他Guid。
string strURL = "http://mySiteUrl";
SearchContext searchContext;
using (SPSite searchSite = new SPSite(strURL))
{
searchContext = SearchContext.GetContext(searchSite);
}
Content sspContent = new Content(searchContext);
ContentSourceCollection sspContentSources = sspContent.ContentSources;
BusinessDataContentSource bdcs = (BusinessDataContentSource)sspContentSources.Create(typeof(BusinessDataContentSource), "MyBdcContentSource");
bdcs.StartAddresses.Add(BusinessDataContentSource.ConstructStartAddress("Default", new Guid("00000000-0000-0000-0000-000000000000"), "LOBSystemName", "LOBSystemInstanceName"));