SharePoint 2013 JavaScript API 記錄


1、獲取創建者字段(Author),oListItem為SPListItem對象

oListItem.get_item('Author')只能獲取到對象,獲取用戶名要用oListItem.get_item('Author').get_lookupValue();

 

2、獲取當前用戶

var clientContext = new SP.ClientContext();
user = clientContext.get_web().get_currentUser();

 

3、不支持SP.ClientContext(),用下面的方法執行

SP.SOD.executeFunc('sp.js','SP.ClientContext',function name);

 

4、更新列表項

var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'Comment');
oListItem.update();

 

PS:自己使用SharePoint JavaScript對象模型時遇到的問題,記下來,方便以后查閱。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM