• .Net新建Sharepoint文件夹方法


     1 public static void AddSharepointFolder(ClientContext clientContext, string NewFolderName)
     2         {
     3             try
     4             {
     5                 Web web = clientContext.Site.RootWeb;
     6                 clientContext.Load(web);
     7                 clientContext.Load(web.Lists);
     8                 clientContext.Load(web, wb => wb.ServerRelativeUrl);
     9                 clientContext.ExecuteQuery();
    10 
    11                 List list = clientContext.Site.RootWeb.GetListByTitle(SPBackListName);
    12                 clientContext.Load(list);
    13                 clientContext.ExecuteQuery();
    14 
    15                 Folder folder = null;
    16                 if (SPBackListFolderName == "")
    17                 {
    18                     folder = web.GetFolderByServerRelativeUrl(web.ServerRelativeUrl + "/" + SPBackListWebName + "/");
    19                 }
    20                 else
    21                 {
    22                     folder = web.GetFolderByServerRelativeUrl(web.ServerRelativeUrl + "/" + SPBackListWebName + "/" + SPBackListFolderName + "/");
    23                 }
    24 
    25                 clientContext.Load(folder);
    26                 clientContext.ExecuteQuery();
    27 
    28                 if (folder != null)
    29                 {
    30                     ListItemCreationInformation creation = new ListItemCreationInformation();
    31                     creation.FolderUrl = folder.ServerRelativeUrl;
    32                     creation.UnderlyingObjectType = FileSystemObjectType.Folder;
    33                     creation.LeafName = NewFolderName;
    34 
    35                     ListItem SubFolder = list.AddItem(creation);
    36                     SubFolder.Update();
    37 
    38                     clientContext.ExecuteQuery();
    39                 }
    40             }
    41             catch (Exception ex)
    42             {
    43 
    44             }
    45         }

    原文出处

       

  • 相关阅读:
    Canvas文字的渲染--进阶
    RK 调试笔记.
    Java Basic
    Android Basics
    RK Android5.1 亮度条、ContentObserver内容观察者模式
    Android 检测外接USB设备、读取GPIO节点
    RK Android7.1 音频播放 Standby
    latch的产生
    git cherry-pick 将其它分支的提交应用到当前分支
    git stash '储藏'当前工作状态
  • 原文地址:https://www.cnblogs.com/61007257Steven/p/10640395.html
Copyright © 2020-2023  润新知