Problem retrieving data collection in Module Builder
Hi,
I have created a custom module using Module Builder. I use the following code to return collection.
// Gets a collection of "live" and "visible" employee items.
protected
IQueryable<DynamicContent> GetDataItems()
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type employeeType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.Employees.Employee"
);
// Fetch a collection of "live" and "visible" employee items.
var myCollection = dynamicModuleManager.GetDataItems(employeeType)
.Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible ==
true
);
return
myCollection;
By default dynamic modules permissions are set to be only accessible to administrators. Check your permissions for this module.
Also, you can suppress security checks. Before you run your code to retrieve the items just set SuppressSecurityChecks to TRUE and then after you are done, set it back to FALSE.
dynamicModuleManager.Provider.SuppressSecurityChecks = true;
Also, here is another post that demonstrates this concept.
www.sitefinity.com/.../concurrent-cms-user-and-custom-control
Hopefully this will help.
Craig