Tuesday, September 21, 2010

Redirect user to a different page when they Login via Form Based Authentication (FBA) in SharePoint 2007

Hello Friends,

We have an application in which we have 3 UserTypes/Roles. Uers are reside under those any one of the UserTypes
When User login, depends on their usertype/role we should redirect them to their homepage.
User are going to Login inside the application via Form Based Authentication.
What steps we need to do to customize login page and make fulfil of our requirement?
Let us look at step by step of our requirement.
1>     Under Layouts Folder, create a new folder give meaningful name like your application name, let us say for example “ApplicationSecurity
2>     The location of the original FBA Login.aspx page is here:  Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS” folder.
3>     Copy Login.aspx under the newly created folder “ApplicationSecurity”. Now we have Login.aspx page is here:Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ApplicationSecurity\Login.aspx
Next, open the web.config for your SharePoint application from the Virtual Directories, find the <forms loginUrl element, and change it from:
    <authentication mode="Forms">
      <
forms loginUrl="/_layouts/login.aspx" />
    </
authentication>
to:
    <authentication mode="Forms">
      <
forms loginUrl="/_layouts/ApplicationSecurity/Login.aspx" />
    </
authentication>
Create a new Class Library project in Visual Studio and add references to Microsoft.SharePoint.dll, Microsoft.SharePoint.ApplicationPages.dll, and System.Web.
Rename Class1.cs to Login.cs.
using System;using System.Collections.Generic;using System.Text;using System.Web;using System.Web.Security;namespace SPFBASolutions.Login
{
   
public class Login : Microsoft.SharePoint.ApplicationPages.LoginPage    {
       
protected override void OnLoad(EventArgs e)
        {
           
base.OnLoad(e);
           
this.login.LoggedIn += new EventHandler(OnLoggedIn);
        }

       
// Fires after user has sucessfully logged in        void OnLoggedIn(object sender, EventArgs e)
        {
           
// Get the user            MembershipUser Logginuser = Membership.GetUser(this.login.UserName);

           
if (Logginuser!= null)
            {
               
//Custom Actions code
            }
        }
    }
}
Next, open the Custom Login.aspx page in Visual Studio which resides under this location Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ApplicationSecurity\ and edit its Assembly and Page declarations to point the new  code behind assembly.
<%@ Assembly Name=" SPFBASolutions.Login,Version=1.0.0.0, Culture=neutral, PublicKeyToken=a9ddedr5gacy9r0bn"%>
<%@ Page Language="C#" Inherits=" SPFBASolutions.Login.Login" MasterPageFile="~/_layouts/custom.master"%>
Last Step, place the compiled assembly into GAC.
Disha Shah

“Access Denied” Error in Sharepoint 2007

Hello Friends

“Access Denied” Error in Sharepoint 2007 :

In an application , when I save some of items under users who are belong to a Group which has Read Permission they get the error “Access Denied” when they add, edit or update any List item. Understood!!!

Then I write the code which do the higher operations against their permissions to under the “System Account” privilegaes  by running code inside this code block SPSecurity.RunWithElevatedPrivileges(delegate() ..
Like

SPSecurity.RunWithElevatedPrivileges(delegate()
{
     SPContext.Current.Web.AllowUnsafeUpdates = true;
     //take the lists and make update operation
     SPContext.Current.Web.Update();
}

Still giving me same error “Access Denied”!!!!  A big frustration!!

But after digging I get what we should be under the SPSecurity.RunWithElevatedPrivileges(delegate().

Under SPSecurity.RunWithElevatedPrivileges(delegate() we should never take an object of SPcontext.current.Web

SPSecurity.RunWithElevatedPrivileges(delegate()
{
                   
      using (SPSite oSite = new SPSite(SPContext.Current.Web.Site.Url))
      {
      // creating a new SPSite running under Application pool idenity
                        
            using (SPWeb oWeb = oSite.OpenWeb())
            {
                oWeb.AllowUnsafeUpdates = true;

                  // Code
            }

It runs like a charm!!!
                               
Attention:

Not assign any variable by using SPContext.Current.Web rather than use adminWeb for example take list like that inside the block SPSecurity.RunWithElevatedPrivileges(delegate().

Disha Shah

Thursday, September 16, 2010

Sharepoint 2010 Developer Training Kit

Hello Friends


Please visit this link for Sharepoint 2010 Developer Training Kit!!

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=83a80a0f-0906-4d7d-98e1-3dd6f58ff059&displayLang=en

Disha Shah

Sharepoint 2010 SDK

Hello Friends

Start learning the Sharepoint 2010 by downloading SDK:

Here are the links where you can find the SharePoint 2010 SDKs.

Update Version : http://blogs.msdn.com/b/randalli/archive/2010/09/09/updated-sharepoint-2010-sdk-now-available-for-download.aspx


Original Version: http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=f0c9daf3-4c54-45ed-9bde-7b4d83a8f26f
 
Hope this helps you to understand and start developing in sharepoint 2010.
Disha Shah

SharePoint 2007 vs SharePoint 2010

Hello Friends

I worked on SharePoint 2007 and loved it !!!

SharePoint 2010 is now a days most popular technology in technology world.

So I thought what is difference between Sharepoint 2007 and Sharepoint 2010?
Read this Article , it is really very nicely described the comparision between Sharepoint 2007 and Sharepoint 2010.

http://www.rharbridge.com/?page_id=103

Hope this helps!!
Disha Shah

Wednesday, September 15, 2010

Sharepoint List Event Handler Types and Example

Hello Friends,
  • Business Case:
    In client organizations there are more than one intranet applications where are related like master- child. So when parent item is deleted at that time all its related child items must be deleted. If not then they are like orphan entries. No use of those entries they just eat up performance when query on that list is executed and also it takes space.
  • Solution:So now delete child entries when its parent entries are deleted we have to use EventHandler in SharePoint.
That’s solution.

Let us go for EventHandler in share point

There are always two types of events attached for every type of event.

1>     Asynchronous – After event occurred
2>     Synchronus –     Before event that occurs

Differences between Sync & Async event handlers are:

1) Synch Event Handler occurs before the event is completed while Asynch occurs after the event is completed.
2) Synch Event Handler is mostly used to stop the event from completion in order to validate few things. It means you can cancel the event using Synch Event Handler while it is not possible to cancel the event from Asynch Event Handler.
3) Synch Event Handler methods has their method names ending with -ing while Asynch Event Handler method names will end with -ed. e.g. ItemAdding, ItemUpdating are Synch Event Handler while ItemAdded, ItemUpdated are Asynch Event Handler methods.
4) Synch Event Handler can be used to Add/Modify the values of list fields while using Asynch Event Handler its not possible as it fires after the completion of event.

Let us look at List Event Handler Solution.
Let me  give you example, I have lists like Program, SubProgram.

So when end user is going to delete Program ,all related its subprogram must be deleted.
Like Parent à Child Relationship. Once parent is deleted we have to delete all its children.
So I created one ListEventhandler.

For any listeventhandler first we have to Implements a related Interface depends on requirement .I have to write Eventhandler for ListItem so I implemented  SPItemEventReceiver.

I added Method is ItemDeleting(Synchronous Event) So after parent list item is deleted this list event handler calls and checkreferencefuntion check whether child list has items with ParentID which we are needed  to be deleted.

I write function because I have more than one child tables for same parent.

So rather than write deleting code for finding child data with same id and deleting data I write code and pass  List and ParentId to that function.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace DeleteData
{
    public class DeleteRefrence : SPItemEventReceiver
    {
        public override void ItemDeleting(SPItemEventProperties properties)
        {
            CheckReferencedata("SubProgram", properties.ListItem["ProgramID"]);
            CheckReferencedata("Department", properties.ListItem["ProgramID"]);
             properties.ErrorMessage = "Parent and Child Items are deleted";
        }
        void CheckReferencedata(String Listname, Object Value)
        {
            SPSite site = new SPSite("SiteURL");
            SPWeb web = site.AllWebs["WebnameWhenthelistsarethere"];
            web.AllowUnsafeUpdates = true;
            SPList list = web.Lists[Listname];
            SPQuery Query = new SPQuery();
            Query.Query = "<Where><Eq><FieldRef Name='ProgramId'/><Value Type='Text'>" + Value + "</Value></Eq></Where>";
            SPListItemCollection AnswerItems = list.GetItems(Query);
            int Count = AnswerItems.Count;
            if (Count > 0)
            {
                for (int index = 0; index < Count; index++)
                {
                    SPListItem item = AnswerItems[index];
                    AnswerItems.Delete(index);
                }
            }
            list.Update();
       }
    }
}

Now we have to register that Eventhandler with that list so when user is delete item we can delete Childitems which are related with that ParentID.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace RegisterEventHandler
{
    public class Program
    {
        static void Main(string[] args)
        {
            Console.ReadKey();
            SPSite collection = new SPSite(http://sitename/);
            SPUser user = new SPUser();
            SPWeb site = collection.RootWeb;
            SPList list = site.Lists["Program"];
            string asmName = "DeleteData, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21ce19119994750e";
            string className = " DeleteData.DeleteRefrence";
            // Register the events with the list
            list.EventReceivers.Add(SPEventReceiverType. ItemDeleting, asmName, className);
          // Clean up the code
            site.Dispose();
            collection.Dispose();
            Console.WriteLine("Sucessfully Registered");
            // Return to calling environment : Success
            Environment.Exit(0);
        }
    }
}

Disha Shah

AJAX and HTMLInputFile - Patch Found

Hello Friends

I want to let you know one result that I found during my development work may be it saves someone's hours and days work.

I was trying to integrate write a webpart where HTMLInputFile control was inside AJAX Update Panel.

But when I was trying to access file which I have uploaded by HTMLInputFile , It always returns "NULL" as HTMLInputFile.PostedFile.

For try,when I deleted AJAX UpdatePanel and run it works fine. So that is bug/error/patch that we can not use HTMLInputFile under AJAX Update Panel.

Disha Shah

Error when trying to update person or group type field type insharepoint List

Hello Friends

 I found one error when I was trying to assign value to List Column which has field type as “Person/Group”. I have one list name as Project and in that list I have column name as “ProjectManager” which has type “Person or group” when I am trying to assign values by programmatically Like below line. listItem["projectmanager"] = "Domain Name\\User Name";

It gives error: Invalid data has been used to update the list item. The field you are trying to update may be read only.

How can we edit or assign value to “Person or group”. I searched and researched and I found solution how can we assign or edit the item which has “Person or group” field type. For that we have to keep in mind some of matters. We can do that thing by:

Spweb Web = Spcontext.Current.Web;

……………………………………………………….

………………………………………………..

Contains code for list declaration and item newly created declaration.

 listItem["projectmanager"] = Web.AllUsers["DomainName\\UserName"].ID;

The thing we have to keep in mind is we have to specify user name not only name of user but with Domain Name.We have to give that person's ID to person/Group Field Type

Disha Shah

Sharepoint Workflow Solution Generator

Hello Friends

Microsoft Visual Studio 2005/2008 offered very nice solution for every part/object of SharePoint with its solution generator file(.wsp file). But we do not have solution generator for Workflow. If we wish then we have to write it manually.

But no need to sad about that we have one tool is available for “Sharepoint Workflow Generator”.

Go to this Link You can find that thing there.

http://blogs.msdn.com/nikhil/archive/2008/03/03/vsto-power-tool-sharepoint-workflow-package-generator.aspx

 All related instructions are available there.

For that you have to make changes at some places like.

You can add this to the end of your csproj/vbproj file to get a wsp file after every build:

<Target>
<Exec Command=”&quot;c:\Program Files\Microsoft VSTO Power Tools 1.0\workflowpackagegen.exe&quot; /featureManifest:feature.xml” ContinueOnError=”true”>
</Exec>
</Target>

And when you run and deploy your workflow you will find out its .wsp file in your workflow folder

You can use that solution package file and you can add and deploy solution. So there is no need to manually thing for solution package.

 It is very good blessings for SharePoint Developers!!!

Enjoy this utility.

Create file upload webpart which creates folders and add files indocument library in Sharepoint

Hello Friends

Business Solutions:

In Project, we have requirement like there is one calculation Budget form and when it is viewed by Analyst, Manager etc. Every user can attach documents and drop comments about form.

Solution:

Here is the webpart for attaching documents and creating foders to sharepoint document library. The main thing I want to share here is how you can access particular folder on SharePoint site. How can you create Folder and get access files from particular folder and upload file on that folder for SharePoint site.

Let me discuss more information on that webpart:

Steps for this project:
  • Open Microsoft Visual Studio 2005/2008.
  • Add new Project.
  • Now go to CodebehindFile

  • For this webpart we need HtmlInputFile for htmlInputFile and FileStream for saving files on that folder. We add two namespaces
              using System.Web.UI.HtmlControls;
              using System.IO;
  • Now we have to create controls Like HtmlInputFile, CheckBox for Overwrite existing file or not, Two buttons for user input (what actions needed to do) Ok and Cancel.
  • Let’s create all Controls which are needed in webparts’s CreateChildControls.
          protected override void CreateChildControls()
          {
 base.CreateChildControls();
                btnOk = new Button();
                btnOk.Text = "OK";
                btnOk.Click += new EventHandler(btnOk_Click);
                btnOk.Width = 80;
 btnCancel = new Button();
 btnCancel.Text = "Cancel";
 btnCancel.Width = 80;
 btnCancel.Click += new EventHandler(btnCancel_Click);
 filePath = new HtmlInputFile();
 chkOverwrite = new CheckBox();
 chkOverwrite.Text = "Overwrite File If Exists!!!";
 this.Controls.Add(filePath);
 this.Controls.Add(chkOverwrite);
 this.Controls.Add(btnOk);
 this.Controls.Add(btnCancel);
     }

You can also specify all control’s custom properties over here according to  requirement.
Then we have to render controls now in this method specify how controls look like.

Difference between “CreateChildControls” and “RenderControl”:

In CretaeChildControls, it just creates controls and adds it to controlcollection.But Rendercontrols specifies that how and in which sequence controls should be displayed.So no matter in which sequence you create controls in CreateChildControls .
Everything depends on RenderControls that decides in which sequence it displays.


public override void RenderControl(HtmlTextWriter writer)
{
     try
    {
               this.filePath.RenderControl(writer);
               writer.Write("&nbsp;");
               this.chkOverwrite.RenderControl(writer);
               writer.Write("<br>");
               writer.Write("<br>");
               this.btnOk.RenderControl(writer);
               writer.Write("&nbsp;");
               this.btnCancel.RenderControl(writer);
           }

           catch (Exception excpt)
          {
                writer.Write(excpt.ToString());
          }       
   }

So now looking at two functions you can differentiate that in createchildcontrols we add btnOk first but in renderchildcontrols we specify before btncancel so it comes after OverwriteCheckbox and before CancelButton.We also specify tags like “<BR>,<HR> with their style, &nbsp;”from writer tag  to look good.

  • On button OK Click Add new file at our sharepoint site’s one of the folder.
Now first thing is that we have to take filename from filepath. Then we have to check whether folder where we    have to upload file is already available of not. If not we have to create that folder.

Then we have to check whether file is there and if yes then we have to overwrite or not by clicking on overwrite exists or not and if overwrite yes we have to delete already exiting file and add file otherwise we do not have to do anything.

void btnOk_Click(object sender, EventArgs e)
{
            SPContext.Current.Web.AllowUnsafeUpdates = true;
    string path = "";
            string[] fileName = filePath.PostedFile.FileName.Split('\\');
     int length = fileName.Length;
     // get the name of file from path
     string file = fileName[length - 1];
            SPFolderCollection folders = SPContext.Current.Web.Folders;
     SPFolder folder;

      if (SPContext.Current.Web.GetFolder("My Files").Exists)
     {
                folder = SPContext.Current.Web.GetFolder("My Files");
      }
      else
      {
                folder = folders.Add("My New Folder");
      }

      SPFileCollection files = folder.Files;
             Stream fStream = filePath.PostedFile.InputStream;
             byte[] MyData = new byte[fStream.Length];
             Stream.Read(MyData, 0, (int)fStream.Length);
             fStream.Close();
             bool bolFileAdd = true;
             for (int i = 0; i < files.Count; i++)
             {
                    SPFile tempFile = files[i];
                    if (tempFile.Name == file)
                   {
                          if (chkOverwrite.Checked)
                          {
                                 folder.Files.Delete(file);
                                 bolFileAdd = true;
                                 break;
                          }
                          else
                          {
                                  bolFileAdd = false;
                                  break;
                           }
             }
     }
     if (bolFileAdd)
     {
           SPFile fff = files.Add(file, MyData);
           SPContext.Current.Web.AllowUnsafeUpdates = false;
      }
    }
  • On Cancel button go back to Or Redirect to previous page.
          void btnCancel_Click(object sender, EventArgs e)
            {
                        Page.Response.Redirect(SPContext.Current.Site.Url);//URL OF PREVIOUS PAGE
            }
Now just Build&Deploy Project and do needed changes need for deploy webpart and add it to your page.

Disha Shah

Sharepoint 2007 - LIST OF MAPPING OF VIRTUAL FOLDERS WITH PHYSICAL FOLDERSPATH

Hey All

Here you can find a list of Mapping of Virtual Folders With Physical Folder Path in Sharepoint 2007.

LocalDrive:\>iisvdir/query “Sharepoint-80”

No.


Alias


Physical Root

1>/_controltemplatesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
2>/_layoutsLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
3>/_vti_binLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI
4>/_wpresourcesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources

LocalDrive:\>iisvdir/query “sharepoint Central Administration v3”

No.AliasPhysical Root
1>/_adminLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN
2>/_controltemplatesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
3>/_layoutsLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
4>/_vti_admLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ADMISAPI
5>/_vti_binLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI
6>/_wpresourcesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources

LocalDrive:\>iisvdir/query “Office Server web services”

No.AliasPhysical Root
1>/SharedServices1LocalDrive:\Program Files\Microsoft Office Servers\12.0\WebServices\Shared

LocalDrive:\>iisvdir/query “Sharepoint - 46281”

No.AliasPhysical Root
1>/_controltemplatesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES
2>/_layoutsLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
3>/_vti_binLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI
4>/_wpresourcesLocalDrive:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources

So Find out files!!!
Disha Shah

How to apply custom master page into SharePoint Site

You can get information regarding master page and branding from below article.

http://dishasharepointworld.blogspot.com/2009/08/sharepoint-master-pages-and-branding_13.html

In this article, I’ll share with you how to apply custom master page into SharePoint root site and its sub sites, here I have created one feature in which I applied custom master page code into Feature Activated Event.

Example Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using System.Collections;
namespace ApplymasterPage
{
class ApplyMasterPage : Microsoft.SharePoint.SPFeatureReceiver
{
public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;
if (site == null)
return;
SPWeb rootWeb = site.RootWeb;
DeactivateWeb(rootWeb);
rootWeb.Update();
foreach (SPWeb subWeb in rootWeb.Webs)
{
ProcessSubWebs(subWeb,
false);
}
}
private void DeactivateWeb(SPWeb web)
{
if (web.AllProperties.ContainsKey("OldMasterUrl"))
{
string oldMasterUrl = web.AllProperties["OldMasterUrl"].ToString();
try
{
bool fileExists = web.GetFile(oldMasterUrl).Exists;
web.MasterUrl = oldMasterUrl;
}
catch (ArgumentException)
{
web.MasterUrl = defaultMasterUrl;
}
string oldCustomUrl = web.AllProperties["OldCustomMasterUrl"].ToString();
try
{
bool fileExists = web.GetFile(oldCustomUrl).Exists;
web.CustomMasterUrl = web.AllProperties[
"OldCustomMasterUrl"].ToString();
}
catch (ArgumentException)
{
web.CustomMasterUrl = defaultMasterUrl;
}
web.AllProperties.Remove("OldMasterUrl");
web.AllProperties.Remove("OldCustomMasterUrl");
}
else
{
web.MasterUrl = defaultMasterUrl;
web.CustomMasterUrl = defaultMasterUrl;
}
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
}
const string defaultMasterUrl = "/_catalogs/masterpage/default.master";
const string customizedMasterUrl = "/_catalogs/masterpage/Custom.master";

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite site = properties.Feature.Parent as SPSite;
if (site == null)
return;
SPWeb rootWeb = site.RootWeb;
rootWeb.AllProperties["OldMasterUrl"] = rootWeb.MasterUrl;
rootWeb.AllProperties["OldCustomMasterUrl"] = rootWeb.CustomMasterUrl;
rootWeb.MasterUrl = customizedMasterUrl;
rootWeb.CustomMasterUrl = customizedMasterUrl;
rootWeb.Update();
foreach (SPWeb subWeb in rootWeb.Webs)
{
ProcessSubWebs(subWeb,true);
}
}
private void ProcessSubWebs(SPWeb web, bool isActivation)
{
if (isActivation)
{
web.AllProperties["OldMasterUrl"] = web.MasterUrl;
web.AllProperties["OldCustomMasterUrl"] = web.CustomMasterUrl;
web.MasterUrl = web.Site.RootWeb.MasterUrl;
web.CustomMasterUrl = web.Site.RootWeb.MasterUrl;
}
else
{
DeactivateWeb(web);
}
web.Update();
foreach (SPWeb subWeb in web.Webs)
{
ProcessSubWebs(subWeb, isActivation);
}
}

}
}

Module and File Tags Explanation in Sharepoint Deployment

Hello     

Let us today talk about Sharepoint Deployment Section.     

There are some situation where we need to add images to 12 hive folder because of it is needed by Sharepoint Application and it should be done by Deployment , Or let us say we need to add some of the already developed templates to document library when we add document library by feature. Sharepoint introduces two important attributes which allows us to do that which we normally defined in Elements.XML Let us understand and look at its detail properties of that two element.   

 The following table gives you description about the various attributes in the <Module> element.  
AttributeDescription
Name Name of the file set. 
Url Site-relative path where the files will be provisioned.  Let us upload one image on "SiteCollectionImages". 
Path Feature-relative path where the source files within the Feature are located. . 
RootWebOnly When set to TRUE, the files in the file set are provisioned in the top-level site of thesite collection. 

   

File sets contain one or more files and each element describes a separate file to provision into a SharePoint site.   

The following table details each of the attributes of <File> in the element.   
AttributeDescription
Name The name to assign the file when provisioned into the SharePoint site. This namebecomes part of the URL to the file.  
Url Feature-relative path to the file. This attribute is combined with the Path attribute inthe element.
Type When provisioning files into SharePoint libraries, this should always be set toGhostableInLibrary. When provisioning files into a SharePoint site but not addingthe file to a library, this should be Ghostable. 

 Example       
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">      

           <Module Name="SiteCollectionImages" List="116" Url="SiteCollectionImages">

               <File Url="footer_tagline.gif" Path="SiteCollectionImages/footer_tagline.gif" Type="GhostableInLibrary" IgnoreIfAlreadyExists="False"></File>  

         </Module 

</Elements>  

 Hope This Helps in Deployment

 Disha Shah