使用powershell如何创建使用BDC的内容?
Technet上New-SPEnterpriseSearchCrawlContentSource的文档不清楚如何执行此操作。
到目前为止,这对我来说似乎最合理,但它不起作用。
$searchapp = Get-SPEnterpriseSearchServiceApplication "MySearchApplication"
New-SPEnterpriseSearchCrawlContentSource -name "My BDC Content Source" -searchapplication $searchApp -Type Business -LOBSystemSet "NameOfMyBdc"
它会创建Business Data Connectivity类型的内容源,但不会检查指定的BDC。
答案 0 :(得分:1)
浪费了很多时间,但终于开始工作了。这对我有用,如果你有更好的解决方案请分享。
$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"));