Sladescross's Blog

Blogging about Sharepoint related stuff

Feature Stapling Order Activation and Thread Wait June 28, 2012

Filed under: Feature Stapling,Separate Thread Synch,Threading,WAIT — sladescross @ 10:29 am

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/68382352-c751-4dea-a67f-69533ee442f6

publicoverride void FeatureActivated(SPFeatureReceiverProperties properties)

{

SPSite site = properties.Feature.Parentas SPSite;

if (null == site)

return;

ThreadPool.QueueUserWorkItem(newWaitCallback(DoWork), new Pair(properties.Feature.Definition.RootDirectory, site.ID));

}

staticprivate void DoWork(Object obj)

{

String rootDirectory = (String)((Pair)obj).First;

Guid siteId = (Guid)((Pair)obj).Second;

while (true)

{

using (SPSite site =new SPSite(siteId))

{

using(SPWeb web = site.OpenWeb())

{

if(true == web.Provisioned)

break;

}

}

Thread.Sleep(100);

}

*** YOUR CODE GOES HERE ***

}

About these ads
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 63 other followers