问题
I am trying to create a silverloght application to open visual studio and deploy it as a webpart in sharepoint site. I am using following code:
dynamic cmd = AutomationFactory.CreateObject("WScript.Shell"); cmd.Run("devenv.exe", 1, true);
this is working fine in standalone silverlight application, however, when I added this as a webpart in sharepoint site. It gives an error that "This operation is not supported in the current context".
Based on my search, the reason for this may be is that AutomationFactory is not available for this application as it requires elevated permission.
Do I have to provide elevated Permission to sharepoint site, if yes, then how to do it?
回答1:
You need perform some configuration to allow use AutomationFactory
:
- Use silverlight 5 (version 4 is not allow it)
- Set registyry key to allow in-browser elevated mode
- Sign Xap with certificate, that installed in user's certificate store in "trusted root"
- Install silverlight application on client machine
You can find right a way by googling, it described in many blogs
来源:https://stackoverflow.com/questions/11429532/how-to-make-automationfactory-available-for-a-silverlight-application-in-a-share