1
列出使用下面的代碼託管元數據列程序添加到列表中:添加託管元數據列在Sharepoint 2013我嘗試用CSOM
Field f = list.Fields.AddFieldAsXml("<Field Type='" + columntype + "' Name='" + columnname + "' DisplayName='" + columnname + "' ShowField='Term1033' />", true, AddFieldOptions.AddFieldToDefaultView);
clientContext.Load(f);
clientContext.ExecuteQuery();
TaxonomyField taxField = clientContext.CastTo<TaxonomyField>(f);
taxField.SspId = this.getDefaultTermStoreId();
taxField.TermSetId = getTermSetIdByName("Instanties");
taxField.AllowMultipleValues = false;
taxField.Open = true;
taxField.TargetTemplate = string.Empty;
taxField.AnchorId = Guid.Empty;
taxField.Update();
list.Update();
clientContext.ExecuteQuery();
列在我的列表中創建一個託管元數據類型列但是我希望用戶選擇的術語沒有填寫在設置中。任何人都有提示設置託管元數據列的TermSet?
getDefaultTermStoreId()和getTermSetIdByName(string)給我正確的GUID;我檢查了!
非常感謝!
附加地修改爲: taxField.TargetTemplate = string.Empty; taxField.AnchorId = Guid.Empty; – Verthosa