Showing posts with label move.. Show all posts
Showing posts with label move.. Show all posts

Sunday, November 13, 2011

Access, Copy, and Move Files


To retrieve files and folders from a Web site, use the GetFile or GetFolder method of the SPWeb class.
You can use the GetFolder method of the SPWeb class to return a specified folder. Then you can access individual files in the folder. After instantiating an SPWeb object (for example, as oWebsite), use SPFolder oFolder = oWebsite.GetFolder("Shared Documents") (in Microsoft Visual Basic, use Dim oFolder As SPFolder = oWebsite.GetFolder("Shared Documents")) to return the Shared Documents folder for the site.
using (SPWeb oWebsite = new SPSite("http://Server/sites/SiteCollection").OpenWeb())
{
    string folderUrl = "/Shared Documents/MySubFolder";
    SPFolder oFolder = oWebsite.GetFolder(folderUrl);
    SPFileCollection collFile = oFolder.Files;

    foreach (SPFile oFile in collFile)
    {
        Label1.Text += "<BR>Url: " + oFile.Url.ToString() + " Size: " + oFile.Length.ToString();
    } 
}

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...