Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I put a web part on a page through a feature.

I deactivate the feature.

Then when I go to activate it again, i loop through the wpManager.WebParts to determine if it is already on the page

using (SPLimitedWebPartManager wpManager = site.GetLimitedWebPartManager(url + page, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)) {
      try {
         SPLimitedWebPartCollection existingParts = wpManager.WebParts;

         //I loop through checking to see if it is on the page) here
    ...

If I manually activate/deactivate it all works fine. The problem occurs when I activate the feature from another feature. Yes, I have one feature that acts as a wrapper which then activates other features in a particular order. Well, when activating this wrapper and doing the loop above the existingParts.Count = 0

I cannot explain this behavior. Ideas?

share|improve this question
Can you give us some more details about for instance your "wrapper" works (and looks like in code)? – Wictor Wilen MCA MCM MVP Sep 26 '10 at 8:33
What scope is this other Feature? – James Love Jul 28 '11 at 10:15
@dave check the properties, I don't think they are coming through as expected to the child feature, wrong scope is the most likely scenario as James Love suggested. – Hugh Wood Nov 13 '12 at 17:20

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.