//创建文档库

$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) };

 

 

相关文章:

  • 2021-09-24
  • 2022-03-02
  • 2021-11-21
  • 2022-12-23
  • 2021-07-24
  • 2022-01-25
  • 2021-05-20
猜你喜欢
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案