Montag, 7. November 2011

Adding a Taxonomy Field

TermStore termStore = session.DefaultKeywordsTermStore;
Group group = termStore.GetSiteCollectionGroup(this.site);
TermSet termset = group.TermSets[0];

TaxonomyField field = (TaxonomyField)list.Fields.CreateNewField("TaxonomyFieldType", name);

field.Required = required;
field.Description = description;
field.SspId = termStore.Id;
field.TermSetId = termSet.Id;
field.AllowMultipleValues = allowsMultiple;
field.EnforceUniqueValues = enforceUniqueValues;
field.IsPathRendered = renderpath;
// field must be indexed to enfoce unique values!
field.Indexed = enforceUniqueValues;
Term anchor = termSet.GetTermByPath(anchorPath);
field.AnchorId = anchor.Id;
field.NoCrawl = noCrawl;

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomysession.aspx

http://www.communardo.de/home/techblog/2011/10/18/sharepoint-2010-der-termstore-und-der-priviligierte-nutzer/


Was wird durch die folgende Methode veranlasst?
Möglicher Fix für Probleme nach Content Deployment
// Resync the taxonomy hidden list to make sure it is update-to-date
TaxonomySession.SyncHiddenList(site);

DisplaceOnUpgrade
Optional Boolean. If a field definition already exists for the field, TRUE to force updates to field properties with the values that are specified in this field definition.

http://www.sharepointconfig.com/2011/03/the-complete-guide-to-provisioning-sharepoint-2010-managed-metadata-fields/

Keine Kommentare:

Kommentar veröffentlichen