Creating Sharepoint Keywords and Best Bets#

I've been posting about competencies, keywords and user profiles in Sharepoint a while ago and I've promised some code, so here is the "Keywords and Best Bets" part (User Profiles will follow up).

Keywords are basically just Portal Area's, so creating keywords is a matter of creating an Area in the keywords Area. This Area is a special Area and can be retrieved using the Object Model.

// Get the current portal context
Microsoft.SharePoint.Portal.Topology.TopologyManager topologyManager =
new TopologyManager();

Uri uri = "[portal url]";

PortalSiteCollection sites = topologyManager.PortalSites;

PortalContext portalContext = PortalApplication.GetContext(sites[uri]);

// Get the guid of the keyword area

Guid keywordGuid = AreaManager.GetSystemAreaGuid(portalContext, SystemArea.Keyword);

Area keywordArea = AreaManager.GetArea(portalContext, keywordGuid);

keywordArea.Areas.AddArea("[keyword]");
keywordArea.Update();
      

It's quite simple as you can see, but what about Best Bets? Keywords are just Area's in a special keyword Area, Best Bets are the Area Listings in this Area. So, creating a Best Bet is about the same code when creating Area Listings in an Area.

// Create guid array that represents the audiences
Guid[] guidAudiences = new Guid[] { new  Guid("00000000-0000-0000-0000-000000000000") };
AreaListing myListing = keywordArea.Listings.AddListing("[Title]","[Description]",ListingType.Person,"[url]",guidAudiences);

myListing.Update(ListingUpdateBehavior.SubmitToSiteRegistry);

keywordArea.Update();

        

This way you're able to create a structure of Keywords and Best Bets dynamically and have influence on the search results. In my opinion this method is quite underestimated because it can improve a lot of efficiency in Information Worker organisations.

Wednesday, April 13, 2005 7:21:41 AM UTC #    Comments [0]  | 

 

All content © 2010, Mart Muller
On this page
This site
Calendar
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Archives
Sitemap
Disclaimer

Powered by: newtelligence dasBlog 1.9.7174.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts