Fórum Root.cz
Hlavní témata => Vývoj => Téma založeno: kennyopc 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:
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
-
Co na to MS support? V chybě tě na něj odkazují...
...a k tomu jsem z křišťálové koule vyvěštil, že můžeš mít ten cloud plnej... Ale třeba se moje koule mýlí...
-
a nemohl vyprset nektery z tokenu?
ja pouzivam client_id, tenant_id, client_secret pro odesilani mejlu pomoci http skrz cloud.
-
Nevypršel bo se tam přihlásím, ale jak tam začne skript cpát fotky tak to hodí toto :( m$ support poslal link na ať si to zkontroluju v entre, ale tam je to v cajku.. a jde o import fotek do o365
-
Jen pro zasmani puvodni hlaska zmizela a naskocilo tohle :D
The term 'Set-UserPhoto' is not recognized as the name of a cmdlet, function, script file, or operable program.
Jsem zvedav co mi rekne na callu dnes m$ support.
-
Zajímavé https://learn.microsoft.com/en-us/powershell/module/exchange/set-userphoto
This cmdlet is available only in on-premises Exchange.
Use the Set-UserPhoto cmdlet to configure the user photos feature that allows users to associate a picture with their account. User photos appear in client applications, such as Outlook, Microsoft Teams, and SharePoint.
Note: In Microsoft 365, you can manage user photos in Microsoft Graph PowerShell. For instructions, see Manage user photos in Microsoft Graph PowerShell.