whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Move Topic Lock Topic Delete Topic New Topic Post Reply
Options
View
Go to last post Go to first unread
Pat  
#1 Posted : Thursday, January 26, 2012 1:22:12 PM(UTC)
Pat
Rank: Newbie

Groups: Registered
Joined: 1/24/2012(UTC)
Posts: 2
Location: France

Hi,

I need to upload hundreds of images from the disk to a sharepoint List using Image Upload. I would like to create a powershell script to do this but I read the thread
http://www.artfulbits.com/support/forum.aspx?g=posts&t=275, and it appears that it is not possible. This thread was posted one year ago, so I wonder if there was an update to the product allowing us to do this?

Thanks for your support
stets  
#2 Posted : Thursday, January 26, 2012 6:09:45 PM(UTC)
stets
Rank: Developers Team

Groups: Registered
Joined: 5/27/2010(UTC)
Posts: 77
Location: Lviv

Hello Pat,

It is possible to upload pictures using SharePoint PowerShell to Image Upload column. The following code snipped demonstrates how to:

1) Initialize objects
Code:
$spWeb = Get-SPWeb -Identity http://SPServer 
$spList = $spWeb.GetList("/Lists/CustomList1")


2)Add UploadImages internal folder to this list (required, if it does not exist yet)
Code:
$spImageContainer = $spList.RootFolder.SubFolders.Add("UploadImages")
$spImageContainer.Update()


3) Each image should be placed in folder with unique name. So, we create this folder for image
Code:
$imgUniqueID = [System.Guid]::NewGuid()
$strImgFolderName = $imgUniqueID.toString("N")
$spImgFolder = $spImageContainer.SubFolders.Add( $strImgFolderName )
$spImgFolder.Update()


4) Upload picture to this folder
Code:
$file = Get-ChildItem C:\filefromdisk.jpg
$fileName = "test.jpg"
$img = $spImgFolder.Files.Add( $fileName, $file.OpenRead(), $false );


5) Add new item to SharePint list and set ImageUpload column value:
Code:
$spItem = $spList.AddItem()
$spItem["Title"] = "Test Item"
$imgUrl = $img.ServerRelativeUrl 
$imgDescription = "image description"
$spItem["ImageColumn1"] = ";#"+$imgUrl+";#"+$imgDescription+";#"
$spItem.Update()


Steps 3,4,5 should be done for every image.

Let me know if you have any question.

Beast Regards,
Yura Stetsuk,
SharePoint Support & Development Team

Edited by user Thursday, January 26, 2012 6:11:47 PM(UTC)  | Reason: Not specified

Pat  
#3 Posted : Friday, January 27, 2012 5:16:35 PM(UTC)
Pat
Rank: Newbie

Groups: Registered
Joined: 1/24/2012(UTC)
Posts: 2
Location: France

Hello stets,

Thank you for this quick and detailed reply. I let you know if I have trouble, as soon as I can test it.

Best Regards
Quick Reply Show Quick Reply
Users browsing this topic
Guest
Similar Topics
Use Image Upload field in page layout (Image Upload Column)
by iozag 9/19/2014 6:46:59 PM(UTC)
Image Upload: Cannot Upload image using code in a Custom Web Part (Image Upload Column)
by Sree 10/5/2012 6:56:31 PM(UTC)
Image Upload: Issue with Custom Permission (Edit only) (Image Upload Column)
by JoshSP 9/20/2012 2:23:59 PM(UTC)
Image Uploader + Reporting Services 2005 (Image Upload Column)
by ShareVision 7/26/2012 2:57:12 AM(UTC)
Image Upload JavaScript Object Model (Image Upload Column)
by sayitfast 7/30/2011 9:21:07 AM(UTC)
Image Upload and Object Model (Image Upload Column)
by gdelgiovine 5/26/2011 9:21:23 PM(UTC)
Image Upload column not visible for anonymous users (Image Upload Column)
by Natalie 5/11/2011 4:49:10 PM(UTC)
Image Upload software (Image Upload Column)
by sfakis 4/25/2011 7:31:47 PM(UTC)
Image Upload software (Public Folder Watcher (PFW))
by sfakis 4/25/2011 7:31:47 PM(UTC)
Image Upload From code behid (Image Upload Column)
by mohan_sg 2/18/2011 9:24:10 AM(UTC)
Image Uploader ;# characters in column data (Image Upload Column)
by oneilaus 12/8/2010 12:11:09 PM(UTC)
Image Upload Column view/edit MsAccess or Datasheet view (Image Upload Column)
by jonscarpa 5/28/2010 1:29:09 AM(UTC)
Image Upload: image size in Edit/Display forms (Image Upload Column)
by rmzeitouny 1/20/2010 3:39:52 PM(UTC)
Move Topic Lock Topic Delete Topic New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You can create polls in this forum.
You can vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2018 ArtfulBits. All rights reserved.