从DCRM 2011将压缩的图像上载到Sharepoint服务器

问题描述:

如何压缩图像,然后将图像从我的DCRM 2011上传到SharePoint Server.

谢谢,

Vishal

How to compress and then upload an image from my DCRM 2011 to SharePoint Server.

Thanks,

Vishal

.NET框架具有System.IO.Compression命名空间以执行内置操作.压缩方法将,

.NET framework has System.IO.Compression namespace to perform the built-in operation. Compression method will be,

public static void Compress(FileInfo fi)
{
    using (FileStream inFile = fi.OpenRead())
    {
        if ((File.GetAttributes(fi.FullName)
            & FileAttributes.Hidden)
            != FileAttributes.Hidden & fi.Extension != ".gz")
        {
            using (FileStream outFile =
                        File.Create(fi.FullName + ".gz"))
            {
                using (GZipStream Compress =
                    new GZipStream(outFile,
                    CompressionMode.Compress))
                {
                inFile.CopyTo(Compress);
                }
            }
        }
    }