通过 PowerShell 创建使用 BDC 的 SharePoint 2010 搜索内容源 [英] Create SharePoint 2010 search content source that uses a BDC via PowerShell

查看:49
本文介绍了通过 PowerShell 创建使用 BDC 的 SharePoint 2010 搜索内容源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 powershell 如何创建使用 BDC 的内容源?

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

关于 New-SPEnterpriseSearchCrawlContentSource 的 Technet 文档在如何做到这一点.

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"

它创建了业务数据连接类型的内容源,但未选中指定的 BDC.

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

您也可以使用这样的 API 来实现.我不知道 ConstructStartAddress 方法的 Guid PartitionId 参数是什么,但它似乎不适用于任何其他 Guid.

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"));

这篇关于通过 PowerShell 创建使用 BDC 的 SharePoint 2010 搜索内容源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆