Article ID: 929261
Article Last Modified on 12/26/2006
APPLIES TO
- Microsoft Office SharePoint Portal Server 2003
INTRODUCTION
This article describes how to add keyword best bets by using the API in Microsoft Office SharePoint Portal Server 2003.
MORE INFORMATION
Keywords are special portal areas. To create keywords, add a subarea to the keywords area, as in the following example.
Uri uri = "http://ServerURL"; TopologyManager tm = new TopologyManager(); PortalSiteCollection sites = tm.PortalSites; PortalContext portalContext = PortalApplication.GetContext(sites[uri]); Guid keywordGuid = AreaManager.GetSystemAreaGuid(portalContext, SystemArea.Keyword); Area keywordArea = AreaManager.GetArea(portalContext, keywordGuid); Area newKeyword = keywordArea.Areas.AddArea("Test"); keywordArea.Update(); //Add synonyms to the newly created keyword newKeyword.AddKeyWord(“String1”); newKeyword.Update();
Keyword best bets are the area listings in the keywords area. The code that you use to create a keyword best bet resembles the code that you use to create area listings in an area. For example, the following sample code can be used to create a keyword best bet.
// Create guid array that represents the audiences (00000000-0000-0000-0000-000000000000 represents all audiences) Guid[] guidAudiences = new Guid[] { new Guid("00000000-0000-0000-0000-000000000000")}; AreaListing myListing = newKeyword.Listings.AddListing("Title","Description",ListingType.Person,"url",guidAudiences); myListing.Update(ListingUpdateBehavior.SubmitToSiteRegistry); newKeyword.Update();
Additional query words: SPS
Keywords: kbexpertiseinter kbhowto KB929261