• SharePoint PowerShell Script Create Document Library,Upload File


    //创建文档库

    $web = get-spweb -Identity http://dexter-pc:90;

    $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary;

    $web.Lists.Add("Document Name","Document Desc",$listTemplate);

    //得到文档库

    $spDocumentLibrary = $web.GetList("Document Name");

    //更该文档库的Description

    $spDocumentLibrary.Description = "My Description";

    //设置文档库是否在快速导航上显示

    $spDocumentLibrary.OnQuickLaunch = "True";

    //更新

    $spDocumentLibrary.Update();

    //在文档库中添加文件夹

    $spFolder = $spDocumentLibrary.AddItem("",[Microsoft.SharePoint.SPFileSystemObjectType]::Folder,"New Folder");

    $spFolder.Update();

    //上传一个文件到文档库

    $spFolder = $web.GetFolder("My Documents");

    $spFileCollection = $spFolder.Files;

    $spFile = Get-ChildItem C:\Documents\Doc.docx;

    $spFileCollection.Add("My Documents/Doc.Docx",$spFile.OpenRead(),$false);

    //上传多个文件

    Get-ChildItem C:\Documents -filter "*.docx"|ForEach{$spFileCollection.Add("My Documents/$($_.Name)",$_.OpenRead(),$true) };

  • 相关阅读:
    redis 资料
    php 安装redis php扩展
    Unity生命周期
    疫情下的大学生人格发展研究
    对联一句——百花深处
    Unity实现byte[]合成图像
    Unity实现精灵资源动态加载
    数据结构与算法初步
    Unity中激活子物体
    C#实现自定义列表
  • 原文地址:https://www.cnblogs.com/dexter2003/p/1937814.html
Copyright © 2020-2023  润新知