SharePoint MySite Yanlış Resim URL’si

Hasan Köroğlu 27 Nisan 2016 0
SharePoint MySite Yanlış Resim URL’si
  • Sumo

Merhaba Arkadaşlar,

Bu makalemizde sizlere MySite yapılandırılması sırasında Active Directory üzerindeki resimlerin SharePoint’e aktarma sırasında olabilecek bir hatadan kaynaklanan sorunun nasıl çözüleceğinden bahsedeceğim.

Daha önce yazmış olduğum bir makalede, Active Directory üzerindeki resimlerin nasıl SharePoint’e aktarılcağından bahsetmiştim. Bu işlem için aşağıdaki PowerShell scriptinin kullanımından bahsetmiştim.

[code lang=”powershell”]Update-SPProfilePhotoStore –MySiteHostLocation http://sp/sites/my –CreateThumbnailsForImportedPhotos:$true[/code]

Bu kodu çalıştırdıktan sonra MySite sayfama baktığımda aşağıdaki görüntü ile karşılaştım.

wrong_picture_url_05

Gördüğünüz üzere resmimin olması gereken yerde resmin bulunamadığı anlamına gelen çarpı işareti mevcut. Resmin özelliklerine baktığımda sorunu farkettim.

wrong_picture_url_04

Resmin adresi https://sp/sites/my/User Photos/…. olması gerekirken bir slash işareti eksik lamış. Bir kontrol de SQL serverda yaptım. Sonuç yine aynı.

wrong_picture_url_03

Bu sorunu aşağıdaki powershell scripti ile düzeltebilirsiniz.

[code lang=”powershell”]$site = get-spsite “http://sp/”

#Give URL of a site collection whose web application is associated with this user profile service application
$context=  [Microsoft.office.server.servercontext]::GetContext($site)
$userProfileManager = new-object Microsoft.office.server.userprofiles.userprofilemanager($context)
$profiles = $userProfileManager.GetEnumerator()
foreach ($profile in $profiles)
{
$Matchurl = “http://sp:80/sites/myUser Photos/Profile Pictures/”
#Provide the incorrect URL for the picture
if($profile[“pictureurl”].value -match $matchurl)
{

Write-host $profile[“AccountName”].value “contains incorrect url”
$CurrentURL = $profile[“Pictureurl”].value
$CurrentURL = $CurrentURL.tostring()
$GoodUrl = “http://sp:80/sites/my/User Photos/Profile Pictures/”
#Provide the correct URL for the picture
$CorrectUrl = $CurrentURL.replace($matchurl,$goodurl)
$profile[“pictureurl”].value = $correcturl
$profile.commit()
Write-host $profile[“AccountName”].value “PictureURL has been corrected”
}
}[/code]

Kod üzerinde, renklendirdiğim yerleri kendi yapınıza göre düzenlemeniz gerekmektedir. Bu scripti SharePoint Management Shell içerisinde çalıştırmanız gerekmektedir.

Kodu çalıştırdığınızda aşağıdaki görüntüyü almanız gerekmektedir.

wrong_picture_url_02

Sonuç:

wrong_picture_url_01

Başka bir makalede görüşmek üzere.

Yorum Bırak »