/// <summary> /// Creates a folder in a document library, if the folder already exists no error occurs /// </summary> /// <param name="destinationUri"></param> /// <param name="sFolderName"></param> public void CreateUrlDirectory(string destinationUri, string sFolderName) { WebUrl webUrl = UrlToWebUrl(destinationUri);
System.Collections.Specialized.NameValueCollection methodData = new System.Collections.Specialized.NameValueCollection();
// Add general request to stream methodData.Add("method","create url-directory:" + GetServerExtensionsVersion(webUrl.SiteUrl)); methodData.Add("service_name",""); //e.g. postin/demosubfolder creates demosubfolder in documentlibrary postin //parentfolders have to exist before creating a child folder methodData.Add("url",sFolderName); methodData.Add("executable","false");
HttpWebRequest req = StartWebRequest(GetAuthorURL(webUrl.SiteUrl), methodData); System.IO.Stream reqStream = req.GetRequestStream(); reqStream.Flush(); reqStream.Close();
HttpWebResponse response = (HttpWebResponse)req.GetResponse(); string sResponseString = GetResponseString(response); //Debug.Write(sResponseString);
}
|