I have build a webpart and imported it into SPS v2, and it works
just fine.
But when I try to use the SPS ObjectModel, I get this error:
Request for the permission of type
Microsoft.SharePoint.Security.SharePointPermission,
Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c failed.
Here's a sample of my code:
using Microsoft.SharePoint;
...
SPWeb web = SPControl.GetContextWeb(Context);
SPList list = web.Lists[0]; //The exception is thrown here
output.Write("List name : "+list.Title);
What is the problem?
Do you know someone who can help? Share a link to this thread on twitter, or facebook.