How to Get a Video Thumbnail preview image in sharepoint Asset Library

namespace ConsoleApplication3
class Program
static void Main(string[] args)
using (var site = new SPSite("http://contoso/sites/teams"))
using (var web = site.OpenWeb())
var list = web.Lists.TryGetList("Videos");
var videoProperties = new Dictionary<string, object>();
videoProperties["Keywords"] = "Intranet Video";
//videoProperties["AlternateThumbnailUrl"] = "/_layouts/images/preview.jpg";
UploadVideo(list, @"C:\Downloads\Video3.mp4", videoProperties);
public static void UploadVideo(SPList list,string fileName,IDict ionary<string,object> properties)
SPFile file;
using (var fileStream = File.OpenRead(fileName))
var urlOfFile = SPUrlUtility.CombineUrl(list.RootFolder.ServerRelativeUrl, Path.GetFileName(fileName));
file = list.RootFolder.Files.Add(urlOfFile, fileStream, true);
list.Update();
//listid = list.ID.add();
SPListItem listItem = list.GetItemById(file.ListItemAllFields.ID);
//SPListItem listItem = list.GetItems("Video3");
var videoContentType = list.ParentWeb.Site.RootWeb.AvailableContentTypes["Video"];
// listItem["ContentTypeId"] = videoContentType.Id;
foreach (var property in properties)
listItem[property.Key] = property.Value;
listItem.Update();
in this code "SPListItem listItem = list.GetItemById(file.ListItemAllFields.ID); " im getting null reference exception.an i have tried with other line "var listItem = file.ListItemAllFields;" same error.any one help me to get solve this
issue.And how to Get a uploaded video Thumnail image.

Hi,
I did a test with your code in my environment and it works fine.
For a better troubleshooting, I suggest you debug your code step by step. You may need to check if file.ListItemAllFields.ID is valid.
If you want to get video Thumnail image, there is a column named Preview Image URL, the internal name of the field is AlternateThumbnailUrl.
You can get the field value using Sever Object Model like below.
String url = item[“AlternateThumbnailUrl”].ToString();
Here is a similar thread for your reference:
http://social.technet.microsoft.com/Forums/en-US/251974d8-18ac-4ff9-88a2-633b5bd80fce/get-asset-library-column-value-preview-image-url-programmatically?forum=sharepointgeneralprevious
More information about how to get list item using Server Object Model:
http://msdn.microsoft.com/en-us/library/office/ms460897%28v=office.14%29.aspx
Best regards,
Zhengyu Guo
Zhengyu Guo
TechNet Community Support

Similar Messages

  • How to get a poster or preview image for my flv file

    I am trying to find out how I can get a static image to show in my flvplayer before someone presses the play button to view the video.
    Details:
    I am brand new to flash, videos, .flv files, flash players, etc. I am very experienced with Dreamweaver, however.
    I had a DVD video. I converted it from DVD to a .flv file. In Dreamweaver, I inserted the .flv file into my web page using Insert - FLV. It added the nifty little flv player with the skins. Everything is working perfectly, except prior to the user clicking play, the video shows just a black screen. I'd like to replace that with a placeholder image (poster image??).
    Here is the page: http://ilovestraightteeth.webscapersites.com/treatments/incognito-braces.shtml
    Is there simply a parameter I add to the object/ embed code? Or do I need to edit the video? Or otherwise? Any help would be appreciated, I'm being bounced from one forum to the next all over the place.
    I've got the adobe cs4 suite, if that information is helpful/relevant. Thanks in advance.

    Thanks, Nancy - that definitely helped! But -- again, I'm totally new to this, so another probably silly question....
    I followed the tutorial and totally got all of that, was able to add my poster frame, tested it, it all worked great. But now my video is in a .fla file; the option to export to FLV is not there. I need to get the video onto my web page now. So I tried exporting it as a .swf file, and then returned to Dreamweaver to insert the .swf file onto the page. I did an insert - SWF, the placeholder showed up, but when I tried to preview, I only got a blank white screen. I went to the Dreamweaver help files to see if I inserted it wrong, but I followed step by step and did it just as it said. (incidentally, a few days ago I tried insterting a different SWF file and the same thing happened).
    (a) do you know why my SWF file is not showing up/previewing?
    (b) is there a different file format I should have exported after I finished the tutorial for adding the poster image, when I had the functional .fla file?
    Thanks again. I really appreciate the response.

  • How can I access the thumbnail/preview image of a PSD file?

    Hey guys I'm trying to salvage some work from a corrupted PSD file via the thumbnail. What happened was I saved my work and closed photoshop and hit the reset button on my PC afterwards by mistake (i dont see why this caused a problem because the program was fully closed at the time). When I open the file now it says it uses an unsupported blending mode, if i press ok I get an error saying incompatible PS version, if I press flatten it says unexpected end of file was encountered. Ive tried PSD repair tools and searched the net for solutions and there doesnt seem to be any - Ive pretty much given up on trying to repair the original file.
    The thing is, the thumbnail of the file seems to be intact because I can still see it as the file icon. I wanted to know if there was any way i can access this thumbnail image so i can enlarge it. Any help would be very appreciated!!

    I have an idea to try...  Earlier I mentioned the Windows Picture Viewer...  Normally that won't read PSD files, but I'm used to using that to look into PSD files because at one point I bought the FastPictureViewer Codec Pack.
    Something to try, and it won't cost anything:
    1.  Try downloading and installing the FastPictureViewer Codec Pack from here:  http://www.fastpictureviewer.com/codecs/
    2.  Once it's installed you get a free trial period, so you can try opening your PSD file by right-clicking on it and choosing Preview.
    If that fails, here's another thing to try:
    Open the Bridge component of Photoshop and navigate to the folder in which you have the file.  It may be able to make a larger thumbnail than the one you're seeing.
    Other than that, are you saying you're seeing the thumbnail in Windows Explorer?  If that's the case, what happens if you right-click in the white space near the file and choose View - Extra Large Icons?
    -Noel

  • How to get the path of the image stored in sap??

    Hi All
    The problem is
    While making an entry in standard there is a field called documents through which we attach our images in sap.
    How to get the path of the image stored with the corresponding order so that the image can be displayed while we are creating a report.
    I know how to upload the image while creating a report using docking control.
    I am not able to get the path of the image stored...
    Please Help
    Thanks in advance..
    Pooja

    I am not aware of exactly which tables are used for storing the attached doc. details, but we have worked in the similar requiremnent.
    What you can do is .... before uploading the image to any order, try swich on the SQL trace ST05 and after upload switch off.
    The log will display what are the tables involved while storing the image. And you can easily find out the image location.

  • How do I change the thumbnail preview picture

    How do I change the thumbnail preview picture?  I've got a 3d model and I want a particular view to be the thumbnail picture as well as the default view.  I believe I've done that before but cannot figure out how I did it.

    I'm working with pages that are comprised only one picture of a 3d object (a table).  I really believe I was able to change the thumbnail to a particular point of view but can't remember how I did it.  It's been so long that I can't remember, but I'm pretty sure I was able to.

  • I am using the window xp and firefox 6. I see many videos on youtube. How I get that videos from the catch folder and where is it?

    I am using the window xp and firefox 6.
    I watch the youtube videos online.
    How I get that video from the catch folder and where that catch folder are situated in the window xp.

    ''How can I view or retrieve a video from Firefox's cache''
    To actually view/retrieve the file from the cache and its web address you can use
    the "Cache Viewer" extension 32.8KB
    * https://addons.mozilla.org/firefox/addon/cacheviewer/
    * http://dmcritchie.mvps.org/firefox/firefox.htm#cacheviewer
    For you to be able to view the cached file you would have had to have watched the entire file.
    The latest version of the extension is 0.7b available in all versions you would have to override compatibility by any of these methods
    * checking or pick up one of the xpi versions in the reader comments for Firefox 6.0
    * extensions.checkCompatibility.6.0 set to False
    *: http://kb.mozillazine.org/Extensions.checkCompatibility
    * or with an extension "Add-on Compatibility Reporter" (84.0 KB) seems preferred in this group
    *:https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/
    There are also extensions such as Video downloader 132.8 KB
    * Download YouTube Videos + Flash Video Downloader / Download-Helper
    *:https://addons.mozilla.org/firefox/addon/download-youtube-videos/
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem after you've tried several things.</small>

  • How to get all video clips to the organize at the same time

    Hi,
    I am a new user and I wonder how to get all video clips to the organize via Get Media or ?? at the same time. Now I have got it one after another and it is very slow.

    My meaning is  to get the clips from hard disk folder. No one after another but all the same time.

  • How to get Document Set property values in a SharePoint library in to a CSV file using Powershell

    Hi,
    How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi,
    According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
    I suggest you can get the document sets properties like the PowerShell Command below:
    [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
    $siteurl="http://sp2013sps/sites/test"
    $listname="Documents"
    $mysite=new-object microsoft.sharepoint.spsite($siteurl)
    $myweb=$mysite.openweb()
    $list=$myweb.lists[$listname]
    foreach($item in $list.items)
    if($item.contenttype.name -eq "Document Set")
    if($item.folder.itemcount -eq 0)
    write-host $item.title
    Then you can use Export-Csv PowerShell Command to export to a CSV file.
    More information:
    Powershell for document sets
    How to export data to CSV in PowerShell?
    Using the Export-Csv Cmdlet
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • When I purchased a music app from itune store. This got downloaded in Itune maedia/Mobile applications.How to get the songs in that app to my  itune library or on to IPAD?

    I  or tranfer to my librarypurchased from Itune store a Music app. It is downloaded into intune media/mobile applications. How to get the full album msic/songs into my itunes library or on tomy IPAD? It doesnot open out. Can anybody suggest a way?

    If you have a music downloader app (depends on which you have), plug your iDevice into iTunes, go to your device (on itunes), go to your apps, scroll down, and select the app thats holding your music, click on "Save As" (should be located bottom right corner), save the music to your specific folder. Once done, follow through this: Adding music and other content to iTunes and you should have your music on your iDevice music app.
    Hope this helps.

  • How to create a video thumbnail???

    I'm pretty new to FCP but I've just finished several shorts and I'm getting ready to upload them to my web site and other video sites. I would like a specific frame to appear as the video thumbnail. (In other words: the "preview frame" that appears in the player when it's not playing).
    No one in my periphery seems to know how to do this.
    Most video sites give you their choices of frames you can use. For instance YouTube gives you three options but chances are none will be the frame you want.
    I would like to select the specific frame I want, regardless of where I upload it.
    Has anyone had experience with this?

    I would like to select the specific frame I want, regardless of where I upload it.
    That's not going to work. The frames available on YouTube are set to specific times in the video.
    Other services such as Vimeo might use a different timing or a different system altogether.
    QuickTime compatible media can take advantage of the Set Poster Frame function and it can be any frame that you choose. Once the clip is outside the QuickTime environment, you take your chances with what's on offer.
    The only way you can have any control over this is to set the poster frame in a QuickTime movie and host it on a compatible site such as MobileMe for example.

  • How do I control the Facebook preview image?

    Help!
    How do I control the preview image that appears when link is shared on Facebook?
    Tried adding code snippet under the <head>, on html view of the page in Business Catalyst... with no luck.

    We have a pre-built Facebook Previews Widget over at MuseThemes.com that achieves this. Simply drag the widget out onto your page, and enter in your page description, title, category and link up an image. There's a complete training video included so you don't get stuck
    Check out the widget here
    Hope this helps! Cheers.
    Steve Harris
    MuseThemes.com

  • How to get network IP camera of images or media ?

    Please tell me how to use jmf to get network IP camera of images or media?
    if you can provide source code, send me please
    my e-mail: [email protected]
    thanks!!&#8857;&#969;&#8857;

    Hi
    m also doing almost same work..wht u r tryied to do. I got the JMF-code, which capture video from webcam & split it in to Frame. But don't know how to capture video from ip-camera.....Can u help me...???

  • Preview Selection Tool-How to get selection size in Preview?

    One of my favorite tricks in Preview (prior to Leopard) was being able to hold the alt-key to get the selection size. Leopard killed this amazing feature and now I have to open Photoshop every time I want to get the size of something. Does anyone out the have any idea how to quickly get selection size in Preview in Leopard? I thought I would just be able to make a selection, crop the image and get the size that way, but worst of all, the image size only reflects the original image size and not the newly cropped size. The latter seems like a bug and the former is annoying.

    I've been on Leopard for a year and I was always able to just put the cursor on the image, draw my box and hit the crop button. In the last week, I've lost the ability to draw my box. It's like it's been disabled. I've restarted to no avail. This was a great little feature as I do not want to load every picture into iPhoto.

  • How to get back default Lock Screen Image of Windows 8.1

    I recently upgraded windows 8 to Windows 8.1, but it reset my custom lock screen image .  I tried for default lock screen of windows 8.1.I can't find any default lock screen
    images of windows 8.1 (Only custom images are available). How to get default lock screen images? Does any any one know? please help me..

    The last "solution" works only for pressing Ctrl+Alt+Delete and clicking
    Lock. If you sign out of Windows and sign back in, that ghastly Windows 8.1 lock screen picture will come back.
    You can delete the img100.png file from your WinSxS folder: right lick on this file, click Properties, click the Security tab, click Edit, click Add, type your Windows user name in the white rectangle under "Enter the object
    name to select", click Check Names, click OK, then click Advanced, click Change, take ownership of the file, give yourself Full control over this file, click Apply and then OK. You may see your name three times in the Security tab (as user, administrator,
    and yourself). Make sure that each instance has full Control
    If this does not work, you can disable the Lock Screen: press Windows+R, type
    gpedit.msc, click OK, in the Local Group Policy Editor window that opens click on Computer Configuration > Administrative Templates > Control Panel > Personalization, right click on the "Do not display the lock screen" option, click
    Edit, check Enabled, then click Apply and OK.
    This, however, is a workaround rather than a real solution, which, it seems, Microsoft does not have.
    I have exactly the same issue with the horrid stripey thing. Furthermore, in Settings, Lock Screen Preview is completely blank both on current and past images.
    I've tried all the tips I've found around the web with no success. I get the horrid stripey thing back.
    I found this freeware called Lock Screen Customizer. Seems to work so far but time will tell. (Note that the download includes both win8 and win8.1 versions.)

  • How to get my video's from iphone 4 onto my laptop ??

    Help ! I have taken several video's on my iphone 4, and have tried several times to get these downloaded onto my laptop so i can save them... the laptop has taken the photo's but will not recognise the video's.... also can't seem to find a way to get them onto facebook either ?? can anyone suggest how to get this sorted ??

    KAY20680 wrote:
    Help ! I have taken several video's on my iphone 4, and have tried several times to get these downloaded onto my laptop so i can save them... the laptop has taken the photo's but will not recognise the video's.... also can't seem to find a way to get them onto facebook either ?? can anyone suggest how to get this sorted ??
    To get them moved to your PC: Connect your iPhone with the USB cable. Once it is recognized, go to My Computer and just select the iPhone as you would any other USB storage device. Copy/paste, cut/paste, click/drag, etc. the picture/video files you want to copy from your iPhone to your PC.
    To post to Facebook: Start up the Facebook app and go to the News Feed. In the top left corner next to the 'What's on your mind?' text window you'll see a camera icon. Touch that and select Choose From Library. Then post away.
    Dave

Maybe you are looking for