문제

I have the need to programmatically define a business data content source in Sharepoint 2010 using C# 2010. I've reviewed ways to do this from within Central Admin, and have seen snippets from MOSS 2007. However, I've not located examples of doing this in SP 2010. Can anyone steer me in the proper direction?

Thanks much for your help and guidance.

도움이 되었습니까?

해결책

This should help you.

다른 팁

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

Using 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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top