Exago .NET API Documentation
NewDataObject Method
Example 
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.
Syntax
public DataObject NewDataObject()
Example
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

Reference

DataObjectCollection Class
DataObjectCollection Members