使用csom元数据字段更新标题字段时,不会使用默认值保存 [英] while updating title field using csom metadata field is not getting saved with default value

查看:67
本文介绍了使用csom元数据字段更新标题字段时,不会使用默认值保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的列表包含2列标题和元数据类型col2.Col2已设置默认值。当我从sharepoint门户创建新项目并保存时我可以看到标题有一些值(我提供)和Col2默认条目我已经设置过一次的条目。

My list contains 2 columns title and Metadata type col2.Col2 has default value set.When I create new item from sharepoint portal and save I can see entries where Title have some values (which I provided) and Col2 with default term which I already set once.

问题是,当我通过程序在列表中创建条目时,我可以看到标题值  ;但是空col2(分类法类型)。

Issue is, when I create entries in list through program then I can see Title value but empty col2 (taxonomy type).

col2  未采用默认值。我可以获得默认值 并且可以通过程序明确设置分类法类型值但是我不想在我执行item.update()时设置Title列值,然后分类col2应该
自动设置它的默认值,因为我已经通过UI设置了它的值。

col2  is not taking default value . I can get default value and can explicitly set the taxonomy type value via program but I don't want to do my question is on setting of Title column value when I do item.update() then taxonomy col2 should automatically set it's default value because I have set it's value through UI already.

请告诉我。

sudhanshu sharma做得好并把它扔进河里:)

sudhanshu sharma Do good and cast it into river :)

推荐答案

嗨夏尔马,

我测试过使用SharePoint CSOM将只有标题列的项目添加到列表中,然后将自动填充托管元数据字段的默认值。

I tested to add item with only title column to the list using SharePoint CSOM and then default value of managed metadata field will be auto populated.

请查看下面的代码段:

            string siteUrl = "http://sp/sites/teams";
            ClientContext clientContext = new ClientContext(siteUrl);
            List oList = clientContext.Web.Lists.GetByTitle("List2");
            ListItemCreationInformation listCreationInformation = new ListItemCreationInformation();
            ListItem oListItem = oList.AddItem(listCreationInformation);
            oListItem["Title"] = "Hello World";
            oListItem.Update();
            clientContext.ExecuteQuery();





谢谢

最好的问候


这篇关于使用csom元数据字段更新标题字段时,不会使用默认值保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆