[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Updating Pictures from PictureLibrary to each individual mysite-sharepoint

Created PictureLibrary with 10 pictures belonging to each user now i want to update these into respective mysite everyday.

Is there any possibility? please let me know.
0
Philx1234567
Asked:
Philx1234567
1 Solution
 
Philx1234567Author Commented:
Each person has one picture and want to move this picture into mysite?
0
 
quihongCommented:
The photo for every user profile is stored in the PictureURL field. You can set it to whatever you want. I use Powershell. Below is sample code
function Get-SPProfileManager([string]$PortalURL)
{
# Need to get a PortalContext object 
# as we do not have a HttpContext we need to source one the hard way
$site=new-object Microsoft.SharePoint.SPSite($PortalURL)
$servercontext=[Microsoft.Office.Server.ServerContext]::GetContext($site)
$site.Dispose() # clean up
# Return the UserProfileManager
new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($servercontext)
}

#SET WEB APPLICATION NAME
$portalurl = "http://portal"

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 
$portal    = new-object Microsoft.SharePoint.SPSite($portalurl)
$portalweb = $portal.OpenWeb()
$upm       = Get-SPProfileManager $portalurl


foreach ($profile in $upm)
{
   $profile["PictureURL"].Value = $portalurl + "/employee photos/" + $profile["EmployeeID"].Value + ".jpg"
   $profile.Commit()
}

$portal.Dispose()
$portalweb.Dispose()

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now