Sponsored Ad

Wednesday, November 16, 2011

Upload files to SharePoint Doc Library from ASP.NET

Upload files to SharePoint Doc Library from ASP.NET Here is the custom code to upload files to SharePoint doc library from ASP.NET. You could use the SharePoint API if you are on the same server or using web services.

Here is the sample code assuming that you know the URL of the document library and to load the document to the root folder. You have to add Microsoft.sharepoint.dll reference to your project ASP.NET

using (SPSite siteCollection = new SPSite(url))
{
using (SPWeb spWeb = siteCollection.OpenWeb())
{
SPList spList = spWeb.GetList(url);
string fileName = "XXXX";
FileStream fileStream = null;
Byte[] fileContent = null;
try
{
string docPath = XXXX; //physical location of the file
fileStream = File.OpenRead(docPath + fileName);
fileContent = new byte[Convert.ToInt32(fileStream.Length)];
fileStream.Read(fileContent, 0, Convert.ToInt32(fileStream.Length));
spList.RootFolder.Files.Add(spList.RootFolder.Url + "/" + fileName, fileContent, true);
spList.Update();
}
catch(Exception ex)
{
}
finally
{
if (fileStream != null)
{
fileStream.Close();
}
}
}
}

Tuesday, November 15, 2011

Microsoft SharePoint Workspace 2010 | YouTube Video

SharePoint 2010 is very quick and functionality wise quite rich. Go through the following video to under stand SharePoint workspace 2010.

SharePoint opens locally on your PC, Enabling you to sync your folders and work on or offline. Collaborating as a team is easy with SharePoint technology.

I like this video, lot of good knowledge is there. Go through it and understand about SharePoint workspace 2010.

Sponsored Ad




Do you want to receive free Sharepoint updates?

Enter your email address:

Website Updates