Useful WSS 3.0 Samples
In Dublin it's always raining, so there's always some time to post a new article. Two useful code snippets for WSS3 developers:
Smartly export a document from a WSS Document Library:
// Set up the webclient with the correct credentials
WebClient webClient = new System.Net.WebClient();
webClient.Credentials = credential;
// Export the document to the given folder
webClient.DownloadFile(documentUrl, docFullPath);
Smartly import (upload) a document to a WSS Document Library:
// Set up the webclient with the correct credentials
WebClient webClient = new System.Net.WebClient();
webClient.Credentials = credential;
// Upload the file
webClient.UploadFile(destinationUrl, "PUT", sourceFilePath);
Comments
Anonymous
August 12, 2007
PingBack from http://msdnrss.thecoderblogs.com/2007/08/12/useful-wss-30-samples/Anonymous
August 27, 2007
very much off topic, but whats the point of having "pingbacks" from other sits, who have just copied and pasted your content.... Isnt the whoel idea and concept of WSS/MOSS so you dont have to duplicate information? I would post this on the other site also, however they dont allow comments. Regards, DanielAnonymous
February 04, 2008
What shd be the destinationURL if my Shared Documents URL is http://my_server_name/Shared%20Documents/Forms/AllItems.aspx Regards, Avi.Anonymous
March 16, 2008
Try http://my_server_name/Shared%20DocumentsAnonymous
October 24, 2008
Thank you for the code snippets. After the upload of the document, it is in a "checked out" status. Is there a simple way to indicate that the document should be marked as "checked in"? Regards, Johan.Anonymous
October 25, 2008
Hey Johan, You need to use the object model or MOSS web services to check the document back in. See http://msdn.microsoft.com/en-us/library/lists.lists.checkinfile.aspx for an example! Chrs, David