Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In Sharepoint 2010 , How to connect between two document libraries in different webapplications using BCS?. The webapplications has sitecollections and sites in it and the sites are getting created programmatically through custom UI.The document libraries mentioned above are situated in the programmatically created sites.

share|improve this question
    
what do you mean by "connect the libraries"? –  C. Marius - MVP Oct 31 '12 at 18:19
    
i need to replicate the content of the document library 1 to document library 2. –  Anu Oct 31 '12 at 19:41
    
0down votefavorite In sharepoint 2010, Need to have a document library in a site and another document library in another site and the 2nd document library should be an exact copy of the 1st document library(with the doucments) in it. When 1st document library is updated with documents , 2nd document library should also populated with the changes made in document library 1. What is the best way to do this? –  Anu Oct 31 '12 at 19:41

1 Answer 1

up vote 1 down vote accepted

Anu,

You should create an Event Receiver on your 1st Document Library and pro-grammatically perform the changes on the 2nd document library...

Read about Event Receivers here

And inside the ItemAdded or ItemUpdated event, you can replicate the changes programmatically to the 2nd document library, pseudo code can look like:

public override void ItemAdded(SPItemEventProperties properties)
{
    if (properties.ListTitle == "FirstDocumentLibrary")
    {
        using (SPSite oSiteCollection = new SPSite(strUrl))
        {
             using(SPWeb oWebsite = oSiteCollection.OpenWeb())
             {
                 //Get file from properties.ListItem

                 //Upload file code
             }
        }
    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.