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

I'm reading a parameter from the url in a site. Then i insert that data in a survey list, but that event receiver only works for administrator, when i use another user i cannot insert that data. I already use elevate privileges. Can you help me with my problem.

share|improve this question
1  
could you show some code? –  David Lozzi Dec 17 '12 at 14:51
add comment

1 Answer

How are you elevating your code?

Are you instatiating you site object elevated or are you using the context one ?

eg:

SPSecurity.RunWithElevatedprivileges(delegate()
{
     using(SPSite site = new SPSite(yoursiteid))
      {
         //site is elevated
      }
     SPSite site2 = SPContext.Current.Site;
     //site2 is not elevated
     //beacuse is a receiver you might be using 
     SPSite site3 = properties.Feature.Parent as SPSite;
     //in this case site3 is also not elevated as you are reusing an existint instance
     //you could do this from the feature receiver (all this assuming that is a Site collection feautre) hence casting the Feature.Parent as SPSite
     using(SPSite site4 = new SPSite(site3.ID))
       {
        //site4 is and new instance and will be elevated
       }
});

Hope this helps

share|improve this answer
add comment

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.