March 12, 2010 at 11:49 am
Hi all,
I am trying to update an existing model, but can't find an update method to the web service, so I delete the existing model and create a new one. The issue is that all the existing adhoc reports don't have the model set correctly now. I was playing with the RegenerateModel method but just get this error (The model specified must be a generated model.).
Here is the gist of the code.. any help would be appreciated.
//Model is in .smdl form so read it in
stream = File.OpenRead(file);
stream.Read(fileContents, 0, Convert.ToInt32(stream.Length));
stream.Close();
//Delete old model
ReportService.DeleteItem([NAME]);
//Create new model
warnings = ReportService.CreateModel([VALUES]);
//Set the data sources references
ReportService.DataSource[] dataSources = new RSUpdater.ReportService.DataSource[1];
ReportService.DataSourceReference dsr0 = new RSUpdater.ReportService.DataSourceReference();
dsr0.Reference = "[VALUE]";
ReportService.DataSource ds0 = new RSUpdater.ReportService.DataSource();
ds0.Item = (ReportService.DataSourceDefinitionOrReference)dsr0;
ds0.Name = "[VALUE]";
dataSources[0] = ds0;
ReportService.SetItemDataSources([VALUES]);
//the above code recreates without an issue.. need to associate all reports with the new model though...
//tried the below command and get the error
ReportService.RegenerateModel(fullpath);
March 12, 2010 at 12:48 pm
I found the answer..
needed to not delete the model..
Just create it and if there is an error - use the SetModelDefinition method to fix all adhoc reports.
Credit to Jasper Smith on his Reporting Services Scripter. I found the answer on one of his code call.
Thanks!
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy