Compartilhar via


Creating a new document in a Document Library

 string _siteUrl = "https://localhost";

                using (SPSite _site = new SPSite(_siteUrl))
                {
                    using (SPWeb _web = _site.OpenWeb())
                    {
                        SPFolder _folder = _web.Folders["<Document Library Name>"];
                        _web.AllowUnsafeUpdates = true;
                        _folder.Files.Add("Contoso Final Document + "." + extension, bytes);
                    }
                }

Comments