1 javascript api url sharepoint sharepoint-2013
任何人都知道如何在SharePoint 2013 JSOM中设置URL字段的描述和URL?我见过的所有字段设置示例都spListItem.set_item(fieldName,fieldValue)适用于简单字段(如文本或数字),但对于复杂的URL字段类型,我失败了.我试过传递我的URL字段名称和逗号分隔fieldValue = "descriptionText,url"
我也尝试过SP.ListItem.parseAndSetFieldValue(fieldname,fieldValue),传递URL字段名称和逗号分隔fieldValue = "descriptionText,url".
我错过了一些简单的东西吗?
使用SP.FieldUrlValue对象:
function updateListItem() {
var currCtx = new SP.ClientContext();
var web = currCtx.get_web();
var lists = web.get_lists();
var myList = lists.getByTitle("List1");
myItem = myList.getItemById(3);
var urlValue = new SP.FieldUrlValue();
urlValue.set_url("http://www.example.com");
urlValue.set_description("test link");
myItem.set_item("TestURL", urlValue);
myItem.update();
Run Code Online (Sandbox Code Playgroud)
currCtx.executeQueryAsync(onUpdateListSucceed,onFail); }
| 归档时间: |
|
| 查看次数: |
10814 次 |
| 最近记录: |