I'm planning to delete my OneDrive subfolders using PowerShell but I'm unable to do it because the sub folders is prettry large, have too many depth and items so just wondering how should I modify my script so that I can delete it.
Under the Parent Folder, I used to have 5 Subfolders. I was able to delete the other 3 subfolders already but I wasn't able to do it for the remaining 2 because of the reason above.
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"
#Key File information for secure connection
$Global:adminUPN = "upn"
$Global:PasswordFile = "C:\scripts\LitHold-OneDrive\key-file\ODpw.txt"
$Global:KeyFile = "C:\scripts\LitHold-OneDrive\key-file\OD.key"
$Global:adminPwd = ""
$CurDate = Get-Date -Format "yyyy-MM-dd"
#Pwd Key Encryption File
$key = Get-Content $Global:KeyFile
$Global:adminPwd = Get-Content $Global:PasswordFile | ConvertTo-SecureString -Key $key
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Global:adminUPN, $Global:adminPwd
#Variables
$SiteURL = "OD URL"
$ServerRelativeUrl= "Documents/parentFolder"
Try {
#Get Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Global:adminUPN, $Global:adminPwd)
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$ctx.Credentials = $Credentials
#Get the web from URL
$Web = $Ctx.web
$Ctx.Load($Web)
$Ctx.executeQuery()
#Get the Folder object by Server Relative URL
$Folder = $Web.GetFolderByServerRelativeUrl($ServerRelativeUrl)
$Ctx.Load($Folder)
$Ctx.ExecuteQuery()
#Call the function to empty Folder
Empty-SPOFolder $Folder
#Delete the given Folder itself
Write-host -f Green "Deleting Folder:"$Folder.ServerRelativeUrl
$Folder.Recycle() | Out-Null
$Ctx.ExecuteQuery()
}
Catch {
write-host -f Red "Error:" $_.Exception.Message
}
#Function to Delete all files and Sub-folders of a given Folder
Function Empty-SPOFolder([Microsoft.SharePoint.Client.Folder]$Folder)
{
Try {
#Get All Files from the Folder
$Ctx = $Folder.Context
$Files = $Folder.Files
$Ctx.Load($Files)
$Ctx.ExecuteQuery()
#Iterate through each File in the Root folder
Foreach($File in $Files)
{
#Delete the file
Write-Host -f Green "$File.Name"
$Folder.Files.GetByUrl($File.ServerRelativeUrl).Recycle() | Out-Null
$Folder.Files.GetByUrl($File.ServerRelativeUrl).DeleteObject() | Out-Null
Write-host -f Green "Deleted File '$($File.Name)' from '$($File.ServerRelativeURL)'"
}
$Ctx.ExecuteQuery()
#Process all Sub Folders of the given folder
$SubFolders = $Folder.Folders
$Ctx.Load($SubFolders)
$Ctx.ExecuteQuery()
#delete all subfolders
Foreach($Folder in $SubFolders)
{
#Exclude "Forms" and Hidden folders
#Call the function recursively to empty the folder
Empty-SPOFolder -Folder $Folder
#Delete the folder
Write-Host -f Green "$Folder.UniqueId"
#$Ctx.Web.GetFolderById($Folder.UniqueId).Recycle() | Out-Null
$Ctx.Web.GetFolderById($Folder.UniqueId).DeleteObject() | Out-Null
$Ctx.ExecuteQuery()
Write-host -f Green "Deleted Folder:"$Folder.ServerRelativeUrl
}
}
Catch {
write-host -f Red "Error: $Folder.UniqueId - $File.Name " $_.Exception.Message
}
}
Related
I want to move all folders as well as subfolders and files in the subfolders from dir 1 to dir 2 in SharePoint Online via PowerShell. The script already moves all files from the main directory of dir 1 (/sites/customer/shared documents/dir 1) to the main directory of dir 2 (/sites/customer/shared documents/dir 2). But somehow it doesn't move files from subfolders like "/sites/customer/shared documents/dir 1/sub 1".
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Function Move-SPOFilesBetweenFolders
{
param
(
[Parameter(Mandatory=$true)] [string] $SiteURL,
[Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $SourceFolder,
[Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $TargetFolder
)
Try {
#Write-host "Copying Files from '$($SourceFolder.ServerRelativeUrl)' to '$($TargetFolder.ServerRelativeUrl)'"
#Get all Files from the source folder
$SourceFilesColl = $SourceFolder.Files
$Ctx.Load($SourceFilesColl)
$Ctx.ExecuteQuery()
#Iterate through each file and move
Foreach($SourceFile in $SourceFilesColl)
{
#Get all files from source Folder
$SourceFile =$Ctx.Web.GetFileByServerRelativeUrl($SourceFile.ServerRelativeUrl)
$Ctx.Load($SourceFile)
$Ctx.ExecuteQuery()
$TargetFileUrl = $SourceFile.ServerRelativeUrl -Replace $SourceFolderURL,$TargetFolderURL
Try {
#Move File to destination
$SourceFile.MoveTo($TargetFileUrl, [Microsoft.SharePoint.Client.MoveOperations]::None)
$Ctx.ExecuteQuery()
Write-host -f Green "File Moved to: "$TargetFileURL
}
catch {
Write-host -f Red "File already exists: "$TargetFileURL
}
}
#Process Sub Folders
$SubFolders = $SourceFolder.Folders
$Ctx.Load($SubFolders)
$Ctx.ExecuteQuery()
Foreach($SubFolder in $SubFolders)
{
If($SubFolder.Name -ne "Forms")
{
#Prepare Target Folder
$EnsureFolderURL = $SubFolder.ServerRelativeUrl -Replace $SourceFolderUrl, $TargetFolderUrl
Try {
$Folder=$Ctx.web.GetFolderByServerRelativeUrl($EnsureFolderURL)
$Ctx.load($Folder)
$Ctx.ExecuteQuery()
}
catch {
#Create Folder
if(!$Folder.Exists)
{
$Folder=$Ctx.Web.Folders.Add($EnsureFolderURL)
$Ctx.Load($Folder)
$Ctx.ExecuteQuery()
Write-host "New Folder Created:"$SubFolder.Name -f Yellow
}
}
#Call the function recursively to move all files from source folder to target
Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SubFolder -TargetFolder $Folder
#Remove the Source Folder
$SubFolder.Recycle() | Out-Null
$Ctx.ExecuteQuery()
}
}
}
Catch {
write-host -f Red "Error Moving File:" $_.Exception.Message
}
}
#Set Parameter values
$SiteURL="https://company.sharepoint.com/sites/customer"
$SourceFolderURL ="/sites/customer/shared documents/dir 1"
$TargetFolderURL ="/sites/customer/shared documents/dir 2"
#Setup Credentials to connect
$Cred= Get-Credential
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get the source and Target Folders
$SourceFolder=$Ctx.Web.GetFolderByServerRelativeUrl($SourceFolderURL)
$Ctx.Load($SourceFolder)
$TargetFolder=$Ctx.Web.GetFolderByServerRelativeUrl($TargetFolderURL)
$Ctx.Load($TargetFolder)
$Ctx.ExecuteQuery()
#Call the function
Move-SPOFilesBetweenFolders -SiteURL $SiteURL -SourceFolder $SourceFolder -TargetFolder $TargetFolder
Only files from the main directory /sites/customer/shared documents/dir 1 have been moved to /sites/customer/shared documents/dir 2. The script should also include subfolders and their files.
I'm quite new to PS-scripting. I need to download files and folders from Sharepoint using Powershell. The script I have works fine, but it stops running when there is an error/exception. I already removed the try/catch which makes the script continue running after an error/exception, but it still has long time-outs before downloading the next file. And in fact I would like to keep catching the errors so I can log the names of the files that caused an error in a txt-file or so.
What is the best way to do all of this?
Function Download-SPOFolder()
{
param
(
[Parameter(Mandatory=$true)] [string] $SiteURL,
[Parameter(Mandatory=$true)] [Microsoft.SharePoint.Client.Folder] $SourceFolder,
[Parameter(Mandatory=$true)] [string] $TargetFolder
)
Try {
#Create Local Folder, if it doesn't exist
$FolderName = ($SourceFolder.ServerRelativeURL) -replace "/","\"
$LocalFolder = $TargetFolder + $FolderName
If (!(Test-Path -Path $LocalFolder)) {
New-Item -ItemType Directory -Path $LocalFolder | Out-Null
}
#Get all Files from the folder
$FilesColl = $SourceFolder.Files
$Ctx.Load($FilesColl)
$Ctx.ExecuteQuery()
#Iterate through each file and download
Foreach($File in $FilesColl)
{
$TargetFile = $LocalFolder+"\"+$File.Name
#Download the fileS
$FileInfo = [Microsoft.SharePoint.Client.File]::OpenBinaryDirect($Ctx,$File.ServerRelativeURL)
$WriteStream = [System.IO.File]::Open($TargetFile,[System.IO.FileMode]::Create)
$FileInfo.Stream.CopyTo($WriteStream)
$WriteStream.Close()
write-host -f Green "Downloaded File:"$TargetFile
}
#Process Sub Folders
$SubFolders = $SourceFolder.Folders
$Ctx.Load($SubFolders)
$Ctx.ExecuteQuery()
Foreach($Folder in $SubFolders)
{
If($Folder.Name -ne "Forms")
{
#Call the function recursively
Download-SPOFolder -SiteURL $SiteURL -SourceFolder $Folder -TargetFolder $TargetFolder
}
}
}
Catch {
$msg = $Error[0].Exception.Message
write-host -f Red "Error Downloading Folder! - $msg"
}
}
#Set parameter values
$orgName="myOrgName"
$admin="myUsrName"
$SiteURL="myUrl"
$FolderRelativeUrl="myFolderUrl"
$TargetFolder="C:\Temp"
#Setup Credentials to connect
$cred = Get-Credential -UserName $admin -Message GlobalAdminLogin
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $cred
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
#Get the Web
$Web = $Ctx.Web
$Ctx.Load($Web)
$Ctx.ExecuteQuery()
$Web.ServerRelativeUrl+$FolderRelativeUrl
#Get the Folder
$SourceFolder = $Web.GetFolderByServerRelativeUrl($Web.ServerRelativeUrl+$FolderRelativeUrl)
$Ctx.Load($SourceFolder)
$Ctx.ExecuteQuery()
#Call the function to download Folder
Download-SPOFolder -SiteURL $SiteURL -SourceFolder $SourceFolder -TargetFolder $TargetFolder
This Script loops over every folder in powershell and checks if the folder has the wildcard text and then outputs the file location towards the csv.
The error i get is : Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
Also some of the folders containing the wildcard. Mostly in level 3 - 4 - 5 it does not detect even tough in the output i see a folder containing the word.
Thanks in advance !
Import-Module PnP.PowerShell
#Config Parameters
$SiteURL= "*******/sites/Archief"
$Folder = "Gedeelde Documenten"
$Pagesize = "500"
Connect-PnPOnline -Url $SiteURL -Interactive ### Change to your specific site ###
#Output path
$outputPath = "C:\users\$env:USERNAME\Desktop\test.csv"
Function GetFolders($folderUrl)
{
$folderColl=Get-PnPFolderItem -FolderSiteRelativeUrl $folderUrl -ItemType Folder
# Loop through the folders
foreach($folder in $folderColl)
{
$newFolderURL= $folderUrl+"/"+$folder.Name
if ($newFolderURL -cnotlike "*archief*"){
write-host -ForegroundColor Green $folder.Name " - " $newFolderURL
$DocLibs = Get-PnPList | Where-Object {$_.BaseTemplate -eq 101}
#Loop thru each document library & folders
$results = #()
foreach ($DocLib in $DocLibs) {
if ($DocLib -cnotlike "*archief*"){
$AllItems = Get-PnPListItem -List $DocLib -Fields "FileRef", "File_x0020_Type", "FileLeafRef" -PageSize 500
#Loop through each item
foreach ($Item in $AllItems) {
if ($Item["FileRef"] -cnotlike "*archief*" -or $Item["FileLeafRef"] -cnotlike "*archief*" -and ($Item["File_x0020_Type"])){
Write-Host "File found. Path:" $Item["FileRef"] -ForegroundColor Green
#Creating new object to export in .csv file
$results += New-Object PSObject -Property #{
Path = $Item["FileRef"]
FileName = $Item["FileLeafRef"]
FileExtension = $Item["File_x0020_Type"]
}
}
}
}
}
GetFolders($newFolderURL)
}
}
}
$results | Export-Csv -Path $outputPath -NoTypeInformation
GetFolders($folder)
There are a few things wrong with your code. First of all, you first output the results to a CSV and after that call the function. Also you loop through the folders, and constantly create a new results object which is never outputted. lastly you call the function itself from within the function. You call GetFolders in a foreach loop within the GetFolders function.
There are a few ways to resolve this, for instance let the CSV be filled from inside the function and append new data.
Import-Module PnP.PowerShell
#Config Parameters
$SiteURL= "*******/sites/Archief"
$Folder = "Gedeelde Documenten"
$Pagesize = "500"
Connect-PnPOnline -Url $SiteURL -Interactive ### Change to your specific site ###
#Output path
$outputPath = "C:\users\$env:USERNAME\Desktop\test.csv"
Function GetFolders{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$FolderUrl,
[Parameter(Mandatory=$true)]
$OutputPath
)
$folderColl=Get-PnPFolderItem -FolderSiteRelativeUrl $folderUrl -ItemType Folder
# Loop through the folders
foreach($folder in $folderColl){
$newFolderURL= $folderUrl+"/"+$folder.Name
if ($newFolderURL -cnotlike "*archief*"){
write-host -ForegroundColor Green $folder.Name " - " $newFolderURL
$DocLibs = Get-PnPList | Where-Object {$_.BaseTemplate -eq 101}
#Loop thru each document library & folders
$results = #()
foreach($DocLib in $DocLibs){
if($DocLib -cnotlike "*archief*"){
$AllItems = Get-PnPListItem -List $DocLib -Fields "FileRef", "File_x0020_Type", "FileLeafRef" -PageSize 500
#Loop through each item
foreach ($Item in $AllItems) {
if ($Item["FileRef"] -cnotlike "*archief*" -or $Item["FileLeafRef"] -cnotlike "*archief*" -and ($Item["File_x0020_Type"])){
Write-Host "File found. Path:" $Item["FileRef"] -ForegroundColor Green
#Creating new object to export in .csv file
$results += New-Object PSObject -Property #{
Path = $Item["FileRef"]
FileName = $Item["FileLeafRef"]
FileExtension = $Item["File_x0020_Type"]
}
}
}
}
}
$results | Export-Csv -Path $outputPath -NoTypeInformation -Append
GetFolders($newFolderURL)
}
}
}
GetFolders -FolderUrl $Folder -OutputPath $outputPath
As you can see the output path is added to the function and the results are pushed to the CSV after every loop.
You could also let the results be created within the function and then returned to the initial call:
Import-Module PnP.PowerShell
#Config Parameters
$SiteURL= "*******/sites/Archief"
$Folder = "Gedeelde Documenten"
$Pagesize = "500"
Connect-PnPOnline -Url $SiteURL -Interactive ### Change to your specific site ###
#Output path
$outputPath = "C:\users\$env:USERNAME\Desktop\test.csv"
Function GetFolders{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$FolderUrl
)
$folderColl=Get-PnPFolderItem -FolderSiteRelativeUrl $folderUrl -ItemType Folder
# Loop through the folders
$results = #()
foreach($folder in $folderColl){
$newFolderURL= $folderUrl+"/"+$folder.Name
if ($newFolderURL -cnotlike "*archief*"){
write-host -ForegroundColor Green $folder.Name " - " $newFolderURL
$DocLibs = Get-PnPList | Where-Object {$_.BaseTemplate -eq 101}
#Loop thru each document library & folders
foreach($DocLib in $DocLibs){
if($DocLib -cnotlike "*archief*"){
$AllItems = Get-PnPListItem -List $DocLib -Fields "FileRef", "File_x0020_Type", "FileLeafRef" -PageSize 500
#Loop through each item
foreach ($Item in $AllItems) {
if ($Item["FileRef"] -cnotlike "*archief*" -or $Item["FileLeafRef"] -cnotlike "*archief*" -and ($Item["File_x0020_Type"])){
Write-Host "File found. Path:" $Item["FileRef"] -ForegroundColor Green
#Creating new object to export in .csv file
$results += New-Object PSObject -Property #{
Path = $Item["FileRef"]
FileName = $Item["FileLeafRef"]
FileExtension = $Item["File_x0020_Type"]
}
}
}
}
}
GetFolders($newFolderURL)
}
}
return $results
}
GetFolders -FolderUrl $Folder | Export-Csv -Path $outputPath -NoTypeInformation
I would also recommend using '-Delimiter ";"' in your Export-CSV so that when you open the file in Excel it is automatically sorted.
I am looking for a way to automatically empty a folder in sharepoint online once a day. I think the best way to do this is using a powershell script from a local server. I tried to search this on google but then I can only find how to delete a folder. But I want to delete all the content within a folder and not the folder itself. Does anyone know a good solution or powershell script for this?
Oke i got a working powershell script from the URL that Theo provided: [https://www.sharepointdiary.com/2018/05/sharepoint-online-delete-all-files-in-document-library-using-powershell.html][1]
the script looks like this:
#Load SharePoint CSOM Assemblies
#Download Sharepoint CSOM Assemblies from https://www.microsoft.com/en-us/download/details.aspx?id=42038
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Variables for Processing
$SiteURL = "https://tenantname.sharepoint.com/sites/TestTeam"
$LibraryRelativeURL = "/sites/TestTeam/Shared Documents/TEST/TestFolder"
Try {
#Get Credentials to connect
$Cred = Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
#Get the Library and Files
$Folder=$Ctx.Web.GetFolderByServerRelativeUrl($LibraryRelativeURL)
$Ctx.Load($Folder)
$Files = $Folder.Files
$Ctx.Load($Files)
$Ctx.ExecuteQuery()
#Iterate through each File in the Root folder
Foreach($File in $Files)
{
#Delete the file
$Folder.Files.GetByUrl($File.ServerRelativeUrl).Recycle() | Out-Null
Write-host -f Green "Deleted File '$($File.Name)' from '$($File.ServerRelativeURL)'"
}
$Ctx.ExecuteQuery()
#Process all Sub Folders
$SubFolders = $Folder.Folders
$Ctx.Load($SubFolders)
$Ctx.ExecuteQuery()
Foreach($SubFolder in $SubFolders)
{
#Exclude "Forms" and Hidden folders
If( ($SubFolder.Name -ne "Forms") -and (-Not($SubFolder.Name.StartsWith("_"))))
{
#Delete the folder
$Folder.Folders.GetByUrl($SubFolder.ServerRelativeUrl).Recycle()| Out-Null
Write-host -f Green "Deleted Folder '$($SubFolder.Name)' from '$($SubFolder.ServerRelativeUrl)'"
}
$Ctx.ExecuteQuery()
}
}
Catch {
write-host -f Red "Error:" $_.Exception.Message
}
Fairly new to both SharePoint online and Powershell and thought this would be a pretty simple task, but I'm reaching out for help.
I have a client who has photos stored in multiple folders in a file share and they want to move this to SharePoint. They want to use the folder name of where the file exits as metadata to make searching easier.
This is the script I am using and not having much luck.
$connection = Connect-PnPOnline https://somecompany.sharepoint.com -Credentials $me -ReturnConnection
$files = Get-ChildItem "F:\some data" -Recurse
foreach ($file in $files)
{Add-PnPFile -Path $file.FullName -Folder Photos -Values #{"Title" = $file.Name;} -Connection $connection}
Issue I am having, is that this does not recurse the folders and comes back with " Local file not found"
If I can get that working, I can move onto getting the current folder name as a variable into metadata.
I'm pretty sure that this will be a simple task for experts, but alas that I am not.Any help will be greatly appreciated.
Thanks
Jassen
This seems to work for me, so will answer this. Happy for comments if there is an easier way or cleaner and also if anyone knows how to go 1 more layer deeper.
$connection = Connect-PnPOnline https://somecompany.sharepoint.com -Credentials $me -ReturnConnection
$LocalFolders = get-childitem -path "c:\test" | where-object {$_.Psiscontainer} | select-object FullName
foreach ($folder in $localfolders) {
$files = get-childitem -Path $folder.FullName -Recurse
foreach ($file in $files) {
$value1 = $file.Directory.Name
Add-PnPFile -Path $file.FullName -Folder Photos -Values #{"Title" = $file.Name;"SubCat" = $value1;} -Connection $connection
}
}
You could try below script, you need install pnp powershell.
function UploadDocuments(){
Param(
[ValidateScript({If(Test-Path $_){$true}else{Throw "Invalid path given: $_"}})]
$LocalFolderLocation,
[String]
$siteUrl,
[String]
$documentLibraryName
)
Process{
$path = $LocalFolderLocation.TrimEnd('\')
Write-Host "Provided Site :"$siteUrl -ForegroundColor Green
Write-Host "Provided Path :"$path -ForegroundColor Green
Write-Host "Provided Document Library name :"$documentLibraryName -ForegroundColor Green
try{
$credentials = Get-Credential
Connect-PnPOnline -Url $siteUrl -CreateDrive -Credentials $credentials
$file = Get-ChildItem -Path $LocalFolderLocation -Recurse
$i = 0;
Write-Host "Uploading documents to Site.." -ForegroundColor Cyan
(dir $path -Recurse) | %{
try{
$i++
if($_.GetType().Name -eq "FileInfo"){
$SPFolderName = $documentLibraryName + $_.DirectoryName.Substring($path.Length);
$status = "Uploading Files :'" + $_.Name + "' to Location :" + $SPFolderName
Write-Progress -activity "Uploading Documents.." -status $status -PercentComplete (($i / $file.length) * 100)
$te = Add-PnPFile -Path $_.FullName -Folder $SPFolderName
}
}
catch{
}
}
}
catch{
Write-Host $_.Exception.Message -ForegroundColor Red
}
}
}
UploadDocuments -LocalFolderLocation C:\Lee\Share -siteUrl https://tenant.sharepoint.com/sites/Developer -documentLibraryName MyDOc4