读列表库附件地址

 if (item.Attachments.Count > 0)
            {
                for (int a = 0; a < item.Attachments.Count; a++)
                {
                    if (a == 0)
                    {
                        this.Label1.Text = "附件 1:<a href=" + item.Attachments.UrlPrefix + item.Attachments[a] + " target=_blank>[" + item.Attachments[a] + "]</a><br>";
                    }
                    else if (a == 1)
                    {
                        this.Label2.Text = "附件 2:<a href=" + item.Attachments.UrlPrefix + item.Attachments[a] + " target=_blank>[" + item.Attachments[a] + "]</a><br>";
                    }
                    else if (a == 2)
                    {
                        this.Label3.Text = "附件 3:<a href=" + item.Attachments.UrlPrefix + item.Attachments[a] + " target=_blank>[" + item.Attachments[a] + "]</a>";
                    }
                }
            } 

上传

if (FileUpload1.PostedFile != null)
        {
            SPSite spsite = new SPSite("http://" + Page.Request.Url.Host.ToString().Trim() + "/sites/RapexChina/AvisoManage/Lists/List9/");
            SPWeb spweb = spsite.OpenWeb();
            Stream stream = FileUpload1.PostedFile.InputStream;

            byte[] buffer = new byte[stream.Length];
            stream.Read(buffer, 0, (int)stream.Length);
            stream.Close();

            spweb.Files.Add("http://" + Page.Request.Url.Host.ToString().Trim() + "/sites/RapexChina/AvisoManage/Lists/List9/", buffer);
        }


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/kxlf4600/archive/2008/12/26/3610406.aspx


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/kxlf4600/archive/2008/12/26/3610407.aspx

原文地址:https://www.cnblogs.com/IsNull/p/1897116.html