I have built a method to pull some UserProfile information out of SharePoint. It works great in C#, but I can't figure out how to convert one part of it to VB.NET. I'm not that great at VB but usually the basic code converters online get me past any problem I have. The problem is concerning the SPSecurity.RunWithEleveatedPrivilages section below. Does any one know how to implement the delegate code in VB?
public List<MyData> GetData(string id)
{
List<MyData> mylinks = new List<MyData>();
SPSecurity.RunWithElevatedPrivileges(delegate
{
var mgr = new UserProfileManager(ServerContext.GetContext("MySSP"));
UserProfile profile = null;
try
{
profile = mgr.GetUserProfile(id);
}
catch { }
QuickLinkManager qlmgr = new QuickLinkManager(profile);
QuickLink[] ql = qlmgr.GetItems();
for (int i = 0; i < ql.Length; i++)
{
mylinks.Add(new MyData(ql[i].Url, ql[i].Title));
}
});
return mylinks;
}
Josh