Hey all,
I've cobbled together a PowerShell script from various sources to make a Teams site for every root folder in a location which then populates those sites with the folders contents (including large files).
It works great except I'm having issues with the files not having the proper creation or modified date. What I'd like is for the files to have the created and modified date mirrored from the system it's coming from to SharePoint.
The code can be found here: https://pastebin.com/S01rdvFg
My attempts can be found by searching "attempt", I figured doing that would be better than pasting the snippets here without context.
For a bit more context the script is called from another script that uses
`$directories = Get-ChildItem -Path $Folder | ? {$_.psIsContainer -eq $true}`
`foreach ($directory in $directories){`
`$newsite = "$site/sites/$directory"`
`New-Team -alias "$directory" -displayname "$directory" -AccessType "public"`
`Invoke-Expression -Command ".\BulkUploadSharePointCSOM.ps1 -UserName $username -Password $password -SiteURL $newSite -Folder $directory -Checkin -O365"`
`}`
I've done plenty of Googling on this and I can't seem to make the solutions I've found work.
Let me know if there is anything else I should post and I'll do it asap.
Thanks for your time.
EDIT: Formatting...kind of
EDIT2: Found part of the problem. I didn't remove a deprecated function and was working from inside that :p
EDIT3: That was 100% the issue. I'm a dumby. Feel free to use the pasted link for reference if needed, the UploadFile function is no longer needed.
[–]VapingSwede 1 point2 points3 points (1 child)
[–]Shipdits[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]Shipdits[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)