开发者

Create SharePoint 2010 search content source that uses a BDC via PowerShell

Using powershell how do you create a content sorce that uses a BDC?

Documentation on Technet for New-SPEnterpriseSearchCrawlContentSource is not very clear on how to do this.

So far this seems most reasonable to me but it doesn't work.

$searchapp = Get-SPEnterpriseSearchServiceApplication "MySearchApplication"
New-SPEnterpriseSearchCrawlContentSource -name "My BDC Content Source" -searchapplication $searchApp -Type Business -LOBSystemSet "NameOfMyBdc"

It creates the content source of type Business开发者_如何学编程 Data Connectivity but the specified BDC is not checked off.


Wasted alot of time on this but finally got it to work. This is what worked for me, if you have a better solution please share.

$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

You can also do it using the API like this. I have no idea what the Guid PartitionId parameter of the ConstructStartAddress method is all about but it doesn't seem to work with any other 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"));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜