views:

81

answers:

1

When checking in a document I execute a web service within the ItemCheckingInEvent. In Dev, no problems. I deployed the app out and it turns out I don't have enough privileges to read a configuration file. My code reads a config file to create the WCF proxy. The real issue is how can I get a return back from my function if I use the SPSecurity.RunWithElevatedPrivileges function?

For example:

SPSecurity.RunWithElevatedPrivileges(delegate()
{

      // exec service call

});

// need data from service call here
+3  A: 

Just declare your working object before the elevated delegate, and assign it inside:

object myServiceData = null;

SPSecurity.RunWithElevatedPrivileges(delegate()
{
      myServiceData = DoServiceStuff();
});

//do things with myServiceData
Rex M