惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
博客园 - 叶小钗
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
美团技术团队
aimingoo的专栏
aimingoo的专栏
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
小众软件
小众软件
T
Tailwind CSS Blog
Martin Fowler
Martin Fowler
B
Blog RSS Feed
月光博客
月光博客
量子位
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
Y
Y Combinator Blog
B
Blog
MyScale Blog
MyScale Blog

博客园 - 翅膀

WCF测试机部署服务器 .net 操作 EXCEL OpenXML 替换word模板中的标签 AgilePoint BPMS 业务流程 List中插入超链接栏 结合eventHanlder和openXMl 实现上传word文档加页眉,页脚 InfoPath 上传多附件解决方法 moss 自定义文档库文档图标 Microsoft Office SharePoint Server 2007的文件目录结构 常用的stsadm命令行参数 如何隐藏“查看所有网站内容” 查看SharePoint未知错误 Layouts里的页面应用站点母板页 MOSS和其他系统的数据集成方式 MOSS中获取当前用户信息 自定义字段类型的开发[转] C#.net中操作XML SharePoint Web Service系列:编写自定义SharePoint Web Services之二 SharePoint Web Service系列:编写自定义SharePoint Web Services之一
关于MOSS中,用代码实现在列表中新增一列为增强型的RichTextField
翅膀 · 2008-11-20 · via 博客园 - 翅膀

                  今天突然收到同事的mail说让我用代码实现在列表中新增一列为增强型的RichTextField,一看需求肯定通过API可以实现的,以前没有做过,所以在网上找了找资料,也没有找到.看来只能看SDK了,于是找了找SDK,结合刚才网上浏览了的资料,终于实现了这玩意

using (SPSite site = new SPSite("http://ascentn-andy/"))
            {

                SPWeb web 

= site.RootWeb;
                web.AllowUnsafeUpdates 
= true;
                SPList list 
= web.Lists["员工列表"];
                
try

                  {
                    list.Fields.Add(

"Name", SPFieldType.Note, true);
                    SPFieldMultiLineText text 
= new SPFieldMultiLineText(list.Fields, "Name");
                    text.RichText 
= true;
                    text.RichTextMode 
= SPRichTextMode.FullHtml;
                    text.Update();
                    list.Fields[
"Name"].Update();

                  }

catch (Exception ex)
                 {
                    Console.WriteLine(ex.ToString());
                 }

          }

不过这边需要注意的是,比如你想把一个单文本的转换为一个多文本的增强型,得现把SPFieldType从Text转到Note,再做处理