Objective:In this article, I am going to create folder inside a document library using the SharePoint object model or in other words using .Net code.Assumption:I do have a document library called "My Documents". I am going to add folder this library. Currently the documents in library are as below. Working Procedure
namespace FileUploadinSharePoint
{
public partial class Form1 : Form
public Form1()
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
private void btnFolderCreate_Click(object sender, EventArgs e)
SPSite _MySite = new SPSite("http://adfsaccount:2222/");
SPWeb _MyWeb = _MySite.OpenWeb();
SPDocumentLibrary _MyDocLibrary = (SPDocumentLibrary) _MyWeb.Lists["My Documents"];
SPFolderCollection _MyFolders = _MyWeb.Folders;
_MyFolders.Add("http://adfsaccount:2222/My%20Documents/" + txtUpload.Text + "/");
_MyDocLibrary.Update();
MessageBox.Show("Docuemnt Created");
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: