zoukankan      html  css  js  c++  java
  • JSOM Create ListFolder

    <script type=”text/javascript”>
    
    var currentcontext = null;
    
    var currentweb = null;
    
    ExecuteOrDelayUntilScriptLoaded(AddFolder, “sp.js”);
    
    function AddFolder()
    {
    
    currentcontext = new SP.ClientContext.get_current();
    
    currentweb = currentcontext.get_web();
    
    this.list = currentweb.get_lists().getByTitle(“ListName“);
    
    var listItemCreationInfo = new SP.ListItemCreationInformation();
    
    listItemCreationInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);
    
    listItemCreationInfo.set_leafName(‘NewFolder‘);
    
    var newItem = list.addItem(listItemCreationInfo);
    
    newItem.update();
    
    currentcontext.load(currentweb);
    
    currentcontext.load(list);
    
    currentcontext.executeQueryAsync(Function.createDelegate(this, this.ExecuteOnSuccess),
    Function.createDelegate(this, this.ExecuteOnFailure));
    
    }
    
    function ExecuteOnSuccess(sender, args) {
    SP.UI.Notify.addNotification(‘Folder created successfully’, false);
    }
    
    function ExecuteOnFailure(sender, args) {
    alert(“Error in Script”);
    }
    
    上善若水 海纳百川
  • 相关阅读:
    async/await
    js继承
    js处理上下文代码的2个阶段
    js相关地址
    vue自定义指令钩子函数
    vue 组件
    vue methods和computed,v-show和v-if
    vue 生命周期
    DOM操作——怎样添加、移除、移动、复制、创建和查找节点
    js 传递参数
  • 原文地址:https://www.cnblogs.com/NetUser/p/2760771.html
Copyright © 2011-2022 走看看