Friday, December 26, 2014

Add automatically a doc lib into sites

Hello,


You can use "SPListEventReceiver.ListAdded" Method to detect newly created list in site.



public class CompanyListCreateEventReceiver : SPListEventReceiver
{
public override void ListAdded(SPListEventProperties properties)
{
base.ListAdded(properties);
SPList l_list = properties.Web.Lists[properties.List.ID];
}
}

http://ift.tt/1vx1tuZ


Later use SPSite to get all its webs and add list to across the site.


To get all subsites: http://ift.tt/1wOdWPa


Note: I would prefer common list template in site to create same list across the site collection. Because once you upload list into site then you can use same temple to create new list. More easy way.


Hope it could help




Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help



No comments:

Post a Comment