Posts

Showing posts with the label Asset Library

SharePoint 2010: How do I load a picture and meta data to an asset library?

I recently had to load some seed data for a SharePoint site that required the population of some images into an asset library. After a lot of playing and experimenting, I eventually settled on the pattern of 1. Add the files to an image folder in the Style Library 2. Reading in the source file into a byte array 3. then loading the array into a new file in the target location. Its a little convoluted, but it was the only solution that met my requirement. I then populated a dictionary with a name/value pair that mapped to the columns in my content type. Here are the methods I used:      public void UploadFile(SPWeb webParam, string fileUrl, SPList list, Dictionary<string, string> parameters)         {             try             {                               using (SPSite site = new SPSite(webPara...