Here is a typical example of the type of calls for help I see within MS and thanks to our global network and unified communications it is easy to help.
I see an email on the internal SharePoint DL from Steve…
|
Subject: programmatically download a document??
Hi all,
Two questions:
Does anyone have any sample code for programmatically downloading/saving a document to a local file from a sharepoint list. For example, given a URL to a doc (http://moss.litwareinc.com/shared%documents/testdoc.docx), I'd like to programmatically save it to c:\testdoc.docx.
…… |
I reply with solution of using UNC path to access the document so that any file operation should work.
Steve sees from the presence indicator next to my name in the email that I'm online and selects "Reply with IM"
Following is the IM chat
Steve [9:12 a.m.]:
hi, thank you for answering my question about getting to files programmatically
do you have a few seconds for a follow up?
Ian Morrish [9:14 a.m.]:
yep
Steve [9:15 a.m.]:
so, in theory I could use something like System.IO.File.Copy() to copy the file locally, right?
Ian Morrish [9:16 a.m.]:
Yes. So long as the client is running the Web Folders windos service
Sorry, it is called the Web Client service
Steve [9:17 a.m.]:
ok I tried System.IO.File.Copy() on a file from my mysite (\\my\sites\stevebus\shared%20documents\atlanta%20mtc.jpg) and it gave me an access denied
how can I tell it to use my network credentials?
Ian Morrish [9:17 a.m.]:
just take out the %20's as these are not valid for UNC path
Steve [9:18 a.m.]:
excellent! that worked perfectly
Ian Morrish [9:19 a.m.]:
try placing the path in the Run command from the start menu (with quotes around it because of the sapces)
Steve [9:20 a.m.]:
File.copy worked with out the %20's
good catch - I missed that
Ian Morrish [9:20 a.m.]:
to confirm the web client is running. This is using a function called the webdav redirectory
redirector
cool, so you are all set to go
Steve [9:21 a.m.]:
just need to get the web folders stuff running from win2k3 too
is this the right way? http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B888123
or is there something easier than hunting down a Windows 2000 or xp box (don't have any of those around)
Ian Morrish [9:23 a.m.]:
I think you can just go to control panel/Services and start the Web Client service
Steve [9:23 a.m.]:
ah, ok... it is started, but I'm not seeing anything under \\moss.litwareinc.com\sites (using the standard moss image provided by the product group)
nevermind
it's \\moss.litwareinc.com\<sitename>
Ian Morrish [9:25 a.m.]:
nothing actually exists in the way of folders at /sites because this is a wildcard inclusion. Just the same as if you go to http://moss.litwareinc.com/sites
Steve [9:28 a.m.]:
seems to be working well... thank you very much for your help
Ian Morrish [9:28 a.m.]:
thanks...