1
Vývoj / Export fotek z O365
« kdy: 11. 07. 2024, 15:52:55 »
Zdravim vsechny mam takovy problem, pouzivam skirp na nahravani fotek uzivatelu do o365 a fungoval bez problemu, nyni mi to vyhodi tuto chybu a uz mi dosli napaday cim to muze byt zpusobeno.
Zde hlaska "A server side error has occurred because of which the operation could not be completed. Please try again after some time. If the problem still persists, please reach out to MS support"
zde kus skriptu:
Dik vsem
Zde hlaska "A server side error has occurred because of which the operation could not be completed. Please try again after some time. If the problem still persists, please reach out to MS support"
zde kus skriptu:
Kód: [Vybrat]
appID = 'xxxx'
$CertificateThumbPrint = 'xxx'
$tenantID = 'xxx'
Connect-ExchangeOnline -AppID $appID -CertificateThumbPrint $CertificateThumbPrint -Organization $tenantID
#nasteveni vsechno erroru na terminating erorry - aby mohli byt chyceny try/catch
$ErrorActionPreference = "Stop"
#Nacteni jednotlivych souboru, prevod na osobni cislo a nasledny upload
"Nahravam jmena ze souboru..." | Out-File $log -Append
# naimportovani fotek s .jpg
get-childitem -include *.jpg -recurse -force -path "\\server\Fotky\O365\Import" | Foreach-Object{
$user = $_.name.TrimEnd(".jpg")
$userphoto = "\\server\Fotky\O365 Import\"+$user+".jpg"
$destination = "\\server\Fotky\O365\Fotky\O365 Imported\"+$user+".jpg"
$nono365destination = "\\seFotky\O365 Chyby\"+$user+".jpg"
#Nahrani fotky do cloudu
Try {
"Nahravam fotku " + $_.Name + " do cloudu..." | Out-File $log -Append
Set-UserPhoto -Identity $user"@xxx" -PictureData ([System.IO.File]::ReadAllBytes($userphoto)) -Confirm:$false
#Pri uspesnem nahrani fotky do cloudu se fotka presune do cilove slozky
Try {
"Fotka " + $_.Name + " uspesne nahrana, presouvam do: "+$destination | Out-File $log -Append
Move-Item $userphoto -destination $destination -Force
Dik vsem