0

I have a customer Web part that is using SharePoint List to show the user details including User Picture.

I need to import AD data into this SharePoint list, I was planning to export a CSV and import it in SharePoint List but have some challenge in it..

  1. If a create a new attribute in AD to save the User Image, how can we get that into the list, with othe details
  2. how to automate the whole process to update the list periodically

Using SharePoint 2013..

0

you can use Timer job for automate the whole process to update the list periodically.

Get records from AD and Update SharePoint list.

You can use Hyperlink or Picture to store the picture

  • by hyperlink or Picture, you mean in AD attribute ! – cjs Jan 27 '17 at 9:51
0

You could use PowerShell to do this and then attach it to a scheduled task. Use the AD cmdlets e.g.

Get-ADUser -Filter * -Properties thumbnailphoto,samAccountName

You could store this information in a custom object (or a csv if you really want) and then add it directly to the list using a function.

[EDIT]Actually you don't need to store it anywhere. You could just add the byte array directly to the SP List. In theory it would look something like this:

Function Add-Item{
[cmdletBinding()]
    Param (
        [string]$spWeb,
        [string]$spList,
        [byte[]]$thumb,
        [string]$samAccountName
    )
    $web = Get-SPWeb $spWeb
    $list = $web.lists[$spList]
    $item = $list.Items.Add()
    $item["ColumnA"] = $samAccountName
    $item.Attachments.Add("$samAccountName.jpg", $thumb)
    $item.Update()
    $web.dispose()
}
$users = Get-ADUser -Filter * -Properties thumbnailphoto
foreach ($i in $users) {
    Add-Item "http://sharepoint" "Documents" $i.thumbnailphoto $i.samAccountName
}
  • could CSV get the Picture from the AD ! – cjs Jan 26 '17 at 7:44
  • Store it in a folder... – Bunzab Jan 26 '17 at 9:11
  • then how can we upload it in list among the other details – cjs Jan 27 '17 at 9:50
  • thinking about it there is no reason to use a csv or the file system. See my edit. – Bunzab Jan 27 '17 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.