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.
-
what do you mean by "connect the libraries"?– Marius ConstantinescuOct 31, 2012 at 18:19
-
i need to replicate the content of the document library 1 to document library 2.– AnuOct 31, 2012 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?– AnuOct 31, 2012 at 19:41
Add a comment
|
1 Answer
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
}
}
}
}