0

I have setup Content Organizer rules and they work 100% as expected by moving the manually uploaded document to the correct folder based on the name of the document. What I would like to do is actually move the document to the right folder based on the rules when I email the document to the drop-off folder (or the document library) ie: no editing of properties and no manual upload of documents. Is this possible?

If there is an easier way to send a document to a specific folder within the Document Folder I'm happy to hear this options too. As far as I can see, emailing the document library can only deliver the email and attachments tot he root of the Document Folder and not to specific folders within it.

thank you

0

I suggest you use PowerShell.

1.Create a column first. Then write the name of the folder which each document should go in the column.

2.Run below PowerShell.

#get the web
$web=get-spweb "your web url"
#get the library
$list=$web.lists['library name']
#get all files
$files=$List.RootFolder.files 
for($i = 0; $i -lt $files.Count){
$file=$files[$i]
#Check if the folde exists, if not create one
$foldername=$file.item['the column name']
$folder=$list.ParentWeb.GetFolder($list.RootFolder.Url + "/" +$foldername)
if ($folder.Exists -eq $false)
{
#Create a Folder
$folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, 
$foldername)    
$folder.Update();
}
#move the file to the folder
$file.MoveTo($folder.Url + "/" + $file.name)
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.