string result = string.Empty;
string strPost = "qf=xml&xml=" + HttpUtility.UrlEncode(xml);
StreamWriter myWriter = null;
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(RequestUrl);
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
objRequest.KeepAlive = false;
try
{
myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);
}
catch (Exception ex)
{
litResult.Text = ex.Message;
}
finally
{
myWriter.Close();
}
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
To check if a folder exists in the CMS already you have to create a folder list. There is no direct commands to do this. dim folderExists folderExists = false set folderlist = asset.getFolderList("/path/") 'loop through folder list do while folderlist.nextEntry() if folderlist.item("_cmsLabel") = "foldername" folderExists = true exit do end if loop To create a folder in the CMS, first make a Model that only contains a folder. Then do the following: if folderExists = false then 'create folder set dict = system.createDictionary() fId = asset.create(folderName, "/Site/Global/Picture of the Week/", "/System/Models/Directory Builder", dict) end if The parameters for the asset.create("label", "Path", "Model to use", content or dictionary)
Comments