Saturday, April 04, 2009

Copy Document Librarys between sites, No Metadata

Hi,

This method help you moving files and folders in Document Librarys between sites without metadata.

This method only works on same Server, external server you need to call webServices "Lists.asmx"

"Remeber this is only a example you can do a lot better and a lot more" :) 

Hope you like...

Here a nice example:

try
{
using (SPSite site = new SPSite("http://[site]"))
{
using (SPWeb web = site.OpenWeb())
{
SPDocumentLibrary docLibrary = (SPDocumentLibrary)web.Lists["Shared Documents"];
SPFolder root = docLibrary.RootFolder;
using (SPSite DesSite = new SPSite("[DestinySite]"))
{
using (SPWeb Desweb = DesSite.OpenWeb())
{
foreach (SPFile file in docLibrary.RootFolder.Files)
{
Desweb.Files.Add(file.Url, file.OpenBinary(), true);
}
}
}
foreach (SPFile file in root.Files)
{
web.Files.Add(file.Url, file.OpenBinary(), true);
}
CopySubFolders(root);
}
}

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}



private void CopySubFolders(SPFolder folder)
{
try
{
using (SPSite site = new SPSite("http://[DestinySite]/"))
{
using (SPWeb web = site.OpenWeb())
{
SPFolderCollection subFolders = folder.SubFolders;
foreach (SPFolder subFolder in subFolders)
{
web.Folders.Add(subFolder.Url);
foreach (SPFile file in subFolder.Files)
{
web.Files.Add(file.Url, file.OpenBinary(), true);
}
CopySubFolders(subFolder);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}


hope this help :)....

Friday, April 03, 2009

SHAREPOINT DESIGNER 2007 IS NOW FREE!

SharePoint Designer 2007
http://www.microsoft.com/downloads/details.aspx?familyid=BAA3AD86-BFC1-4BD4-9812-D9E710D44F42&displaylang=en

"SHAREPOINT DESIGNER 2007 IS NOW FREE! Be sure to watch the video in the "Related Resources" below to learn more about details and future direction. Office SharePoint Designer 2007 provides the powerful tools you need to deliver compelling and attractive SharePoint sites and quickly build workflow-enabled applications and reporting tools on the SharePoint platform, all in an IT-managed environment."