jid*_*l21 6 sharepoint list contenttype
我使用了一段代码来检索指定内容类型的字段链接,并将字段设置为必需或不需要.这工作正常,但是当我尝试对名称中包含空格的字段执行相同操作时,代码会引发错误.
SPField col = //some column retrieved from a list
SPContentType ct = col.ParentList.ContentTypes["MyContentTypeName"] //gets the content type
SPFieldLink fieldLink = ct.FieldLinks["MyFieldname"]; // gets the fieldLink
ct.Update();
Run Code Online (Sandbox Code Playgroud)
如果它MyFieldName是一个像"Hobbies"或"Amount"的字符串,它会起作用,但如果它是一个像"Full Name"这样的字符串则会失败.
有解决方法吗?
| 归档时间: |
|
| 查看次数: |
1076 次 |
| 最近记录: |