PrepAway - Latest Free Exam Questions & Answers

Which code segment should you add to the application?

You need to create a custom application that provides users with the ability to create a managed property.

The managed property name must be specified in the args[1] parameter.

You write the following code segment for the application. (Line numbers are included for reference only.)

01 SPSite currentSite = new SPSite(“http://intranet”);
02 SearchContext context = SearchContext.GetContext(currentSite);
03 Schema schema = new Schema(context);

Which code segment should you add to the application?

PrepAway - Latest Free Exam Questions & Answers

A.
context.SearchApplication.CrawlStores.Create(args[1]);

B.
ManagedPropertyCollection properties = schema.AllManagedProperties;
ManagedProperty newMng = properties.Create(args[1], ManagedDataType.Text);

C.
ManagedPropertyCollection properties = schema.AllManagedProperties;
ManagedProperty newMng = properties.CreateCrawlMonProperty();
newMng.Name = args[1];

D.
schema.AllCategories.Create(args[1], Guid.NewGuid());

Explanation:
MNEMONIC RULE: “properties.Create()”

Use the AllManagedProperties property of the Schema class to get the collection of managed properties in the Shared Service Provider’s search schema.

To add a new managed property to the collection, use the Create() method.

ManagedPropertyCollection Class
http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.managedpropertycollection.create.aspx


Leave a Reply