本文整理汇总了C#中System.Guid.ValidateNotNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.ValidateNotNullOrEmpty方法的具体用法?C# Guid.ValidateNotNullOrEmpty怎么用?C# Guid.ValidateNotNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.ValidateNotNullOrEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTaxonomyField
/// <summary>
/// Can be used to create taxonomy field remotely in a list. Associated to group and term set in the GetDefaultSiteCollectionTermStore
/// </summary>
/// <param name="list">List to be processed</param>
/// <param name="id">Unique Id for the taxonomy field</param>
/// <param name="internalName">Internal Name of the field</param>
/// <param name="displayName">Display name</param>
/// <param name="group">Site column group</param>
/// <param name="mmsGroupName">Taxonomy group </param>
/// <param name="mmsTermSetName">Term set name</param>
/// <param name="multiValue">If true, create multi value field</param>
/// <returns>New taxonomy field</returns>
public static Field CreateTaxonomyField(this List list, Guid id, string internalName, string displayName, string group, string mmsGroupName, string mmsTermSetName, bool multiValue = false)
{
id.ValidateNotNullOrEmpty("id");
internalName.ValidateNotNullOrEmpty("internalName");
displayName.ValidateNotNullOrEmpty("displayName");
mmsGroupName.ValidateNotNullOrEmpty("mmsGroupName");
mmsTermSetName.ValidateNotNullOrEmpty("mmsTermSetName");
var clientContext = list.Context as ClientContext;
TermStore termStore = clientContext.Site.GetDefaultSiteCollectionTermStore();
if (termStore == null)
throw new NullReferenceException("The default term store is not available.");
// get the term group and term set
TermGroup termGroup = termStore.Groups.GetByName(mmsGroupName);
TermSet termSet = termGroup.TermSets.GetByName(mmsTermSetName);
list.Context.Load(termStore);
list.Context.Load(termSet);
list.Context.ExecuteQuery();
return list.CreateTaxonomyField(id, internalName, displayName, group, termSet, multiValue);
}