题
我需要使用 C# 2010 以编程方式在 Sharepoint 2010 中定义业务数据内容源。我已经查看了在 Central Admin 中执行此操作的方法,并且看到了 MOSS 2007 中的片段。但是,我在 SP 2010 中没有找到这样做的示例。有人能引导我走向正确的方向吗?
非常感谢您的帮助和指导。
解决方案
这 应该对你有帮助。
其他提示
使用API
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"));
使用Powershell
$searchapp = Get-SPEnterpriseSearchServiceApplication "My Search Service Application Name"
$lobSystems = @("LOBSystemName1","LOBSystemNameInstance1")
$proxyGroup = Get-SPServiceApplicationProxyGroup -default
New-SPEnterpriseSearchCrawlContentSource -name "My Content Source Name" -searchapplication $searchApp -Type Business -LOBSystemSet $lobSystems -BDCApplicationProxyGroup $proxyGroup
不隶属于 StackOverflow