开发者

Save a WriteableBitmap as an image to SharePoint document library

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.


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


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.

Here's an example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜