views:

262

answers:

1

Hi

Hoe to get the full path of the file that saved on into sharepoint document library. I have one requirement, in this if i upload one file to the document library, then i want to save the Doc path of the same to the DB. please help me to implement this task. Thanks in advance..

A: 

You can write some code to ItemAdded event handler and deploy it as a feature:

public override void ItemAdded(SPItemEventProperties pobjSPItemEventProperties)
{         
    using (SPWeb objSPWeb = pobjSPItemEventProperties.OpenWeb())
    {
        string strFileUrl = pobjSPItemEventProperties.ListItem.File.Url;
        //save to DB here
    }
}  
Amit