Exago .NET API Documentation
NewDataObject Method
WebReports.Api.Roles Namespace > DataObjectCollection Class : NewDataObject Method
Create and return a new DataObject object and add it to the collection. The new DataObject object is created with the default DataObject constructor. The Name Property of the object should be set right away to make it meaningful.
public DataObject NewDataObject()
Create a new Data Object for this session, restricting the user in the Role to only access it
//Add the campaigns table to this new data source
Entity myNewEntity = api.Entities.NewEntity("CampaignsRole");
myNewEntity.DataSourceId = api.DataSources.GetDataSource("Donations").Id;
myNewEntity.ObjectType = DataObjectType.Table;
myNewEntity.Id = "campaigns_10";
myNewEntity.DbName = "Campaigns";
myNewEntity.Name = "campaigns";
myNewEntity.ObjectDescription = "Fundraising campaigns";
myNewEntity.Category = "CRM\\Sales";

//Create a role that restricts user to ONLY that Data Object
api.Roles.NewRole("Restricted User");
Role r = api.Roles.GetRole("Restricted User");
DataObject d = r.Security.DataObjects.NewDataObject();
d.Name = myNewEntity.Id;
r.Security.DataObjects.IncludeAll = false;
See Also


DataObjectCollection Class
DataObjectCollection Members