Follow in Twitter & Facebook


Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools



Monday, October 31, 2011

Copy files from one folder to another using object model in SharePoint

- 1 comment
We can copy files from one folder to another folder using SharePoint object model in SharePoint 2010.

SPWeb site = SPContext.Current.Web;
SPFolder folder = site.GetFolder("Source folder name");
SPFileCollection spFileCollection = folder.Files;
List<SPFile> lstFiles = new List<SPFile>(spFileCollection .Count);
//Get all the files from the folder and put it in a list of type SPFile
foreach (SPFile file in spFileCollection)
{
    lstFiles.Add(file);
}

//The below code will take a file and move to the destination folder. it will continue till the end of all the files in the list
foreach (SPFile singleFile in listFiles)
{
    singleFile.MoveTo("Destination foldername/" +singleFile.Name, true);
}

You can also check SharePoint 2010 Articles and SharePoint Jobs.

Sunday, October 23, 2011

XSLT list view web part in SharePoint 2010

- No comments
Introduction:
In this article we will see What is XSLT list view web part in SharePoint 2010 and also we will discuss various steps to use XSLT list view web part. In my previous article we have discussed about Web Part life cycle in SharePoint 2010.

Description:
The list view web part are used by SharePoint to list and library data. When a new list is created, the web part for the list is also created automatically. List view web parts can show one view at a time from the list or library to which it is pointing. If you want to show more than one view of a list or library on the same page, just deploy a new list view web part pointing to the same list, then configure it to show a different view of the list. Once you insert the web parts into the page, it is easily customizable by using browser.

The list view web part is obsolute in SharePoint 2010. The new web part is known as XSLT List View Web Part. You can deploy the web part into a SharePoint page by using either browser pr by using SharePoint designer.

How to use:
To add this by the browser, go to the page then from the Ribbon click on Insert web part and from there go to the List and Libraries section and select the web part.

How it works:
It first queries the list or library data and retrieves it as XML. Then it uses industry-standard eXtensible Stylesheet Language Transformation (XSLT), which is a style sheet language for XML documents, to convert the XML data into HTML that the browser can understand and display to the end user. It uses shared XSLT style sheets that are presented inside the _layouts directory.
Also you can check Content Editor Web Part in SharePoint 2010.

Friday, October 21, 2011

Site Page and an Application Page in SharePoint 2010

- No comments
Introduction:
This article is based on what are site pages and application pages in SharePoint 2010 and also what is the difference between site pages and application pages. Also you can visit this article to know how to create application page using Visual Studio 2010?.

Description:
There are two types of pages in SharePoint.
1. Site Pages
2. Application Pages
Common on them: They both inherit their layout from the same master page.

1. Site Pages:
- A site page contains text, images, web parts etc and Site pages are stored in the file system.

- An end user can create, edit or customized a site page using SharePoint designer or browser.

- Once an end user modified the site page using SharePoint designer, the template for this page is stored in the content database rather in file system. So every time a user requested the page, the page is retrieved from the content database. At the same time you can also reset to the original template using designer.

- A site page can contain inline server code, but once it becomes customized it can not contain. A site page can also host features such as dynamic Web Parts, and Web Part Zones.

Example: Default.aspx

2. Application Pages:
- Application pages are stored on the file system of the front-end Web server in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS directory. This folder is mapped to an Internet Information Services (IIS) virtual directory called _layouts.

- Application page is complied into a single DLL, that why performance is better than site pages. These pages are share accross all the sites in the web application.

- An application page can not host features such as dynamic Web Parts, and Web Part Zones.

- It support inline code and also if you want to run custom code then it is better to use application pages.

Example: Settings.aspx
You can also check SharePoint 2010 Best Practices.

Sunday, October 16, 2011

Document Panel in SharePoint 2010

- No comments
In this article we will discuss what is document panel in SharePoint 2010. Also you can check what is document sets.
  • Document Panel that is used for displaying the content type associated with a document and columns defined by content type. This is a feature of word.
  • If you change the value of a column from the document panel and save the document back to the SharePoint library that information travels together with the document to the SharePoint library.
  • Also if you edit the document’s columns in the SharePoint library and save the changes, the next time you open that document in Word you will see the changes in the Document Panel.

Friday, October 14, 2011

content type in SharePoint 2010

- No comments
Content types can provide is a way to define the type of the content stored in SharePoint and proper fields to associate with that content. For example I want to store company name field with every word document. or you can say a content type is a collection of settings that can be applied to different types of content. Content types can be applied to SharePoint list. SharePoint can store multiple content types in a document library. Only one content type can be applied to a particular item in a document library or list.

Each content type has a distinctive set of properties and metadata that describe the content. This can include fields that are associated with the content type that can be displayed as columns in the list or document library. It can also include a specific document template used when creating instances of the content type.

Each content type inherits its attributes and settings from a parent content type. So every time you want to create a content type we need to select an existing parent content type.
All content types are stored in hierarchy. And in the root System content type is there, and below that Items content type is there. We could distingush as Site content type and list content type.Site content types are templates that are available throughout the site collection. And list content type are available to that list and to none of the other sites or lists. You can also check a good article on how to create content type in SharePoint 2010 using Visual Studio 2010.