Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, November 28, 2011

Creating a SubFolder inside a list using SharePoint Default WebServices

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MyService;
using System.Xml;
public partial class Default16 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
MyService.Lists listProxy = new MyService.Lists();

//string xmlconst = "0http://vlnrm:100/Sample/Lists/MyList/TestFolder2/Test001/"+txtCreateSubFolder.Text+"";
string str = "TestFolder2/" + txtCreateSubFolder.Text;
if (str.ToString().Contains("&"))
{

//str = str.Replace("&", "/g");

}
string xmlconst = "1" + str + "";




listProxy.Url = "http://vlnrm:100/Sample/_vti_bin/lists.asmx";
listProxy.UseDefaultCredentials = true;


string strListName = "MyList";
XmlDocument xmlDoc = new System.Xml.XmlDocument();

System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");

elBatch.SetAttribute("OnError", "Continue");

elBatch.SetAttribute("ListVersion", "1");


elBatch.InnerXml = xmlconst;

XmlNode ndReturn = listProxy.UpdateListItems(strListName, elBatch);

string result = ndReturn.OuterXml.ToString();
Page.RegisterClientScriptBlock("alert", "");
txtCreateSubFolder.Text = "";
}
}

No comments:

Post a Comment