Reputation: 333
I have a requireemnt in which I have to upload a WriteableBitmap generated as an image in to SharePoint document library. Can anyone please help me ? Thank you.
Upvotes: 0
Views: 627
Reputation: 1687
Heres an extension method to convert the WriteableBitmap to byte array
public static byte[] ToByteArray(this WriteableBitmap bmp)
{
int[] p = bmp.Pixels;
int len = p.Length * 4;
byte[] result = new byte[len]; // ARGB
Buffer.BlockCopy(p, 0, result, 0, len);
return result;
}
taken from this blog http://kodierer.blogspot.com/2009/11/convert-encode-and-decode-silverlight.html
To upload it to a document library with the Client OM you can use this tutorial http://www.zimmergren.net/archive/2010/06/10/sp-2010-uploading-files-using-the-client-om-in-sharepoint-2010.aspx
Upvotes: 1
Reputation: 18530
If you're working with SharePoint 2010, you can use the client object model for Silverlight. It's very similar to the client object model for .net, except that it's asynchronous.
Upvotes: 0