Thursday, August 11, 2005

Using FrontPage RPCs and SharePoint

If you really want to learn about FrontPage Server Extensions RPCs and SharePoint, you should take a look at the code for SharePad on GotDotnet. I have used it in a project and have extended it a little bit. This is definitely an excellent resource for everybody. Underneath is the code I added to create a folder in a SharePoint document library.

/// <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);

 

}

 

 


[Listening to: Petty Thug - Millionaire - Outside the Simian Flock (05:19)]

1 comment:

naveed said...

thanks, it got out me from fire :)