I’m just trying to set a shared data source.
I keep getting the exception
The operation you are attempting on item is not allowed for this item type.
Maybe I have something mixed around but I’m unable to nail it down.
filepath=/Base/Vendor (full path of the report);
datasource = IBBase
public static void UpdateDataSource(string filepath, string datasource)
{
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
ServicesReport.DataSourceReference reference = new ServicesReport.DataSourceReference();
reference.Reference = filepath;
ServicesReport.DataSource[] dataSources = new ServicesReport.DataSource[1];
ServicesReport.DataSource ds = new ServicesReport.DataSource();
ds.Item = (ServicesReport.DataSourceDefinitionOrReference)reference;
ds.Name = datasource;
dataSources[0] = ds;
try
{
rs.SetReportDataSources(filepath, dataSources);
Console.WriteLine("New reference set for the report.");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
This Connect call reports the same error code using the SetItemDataSources method: http://connect.microsoft.com/SQLServer/feedback/details/318868/ssrs-2005-sp2-setitemdatasource-web-method-bug#details.
The bottom-line of the answer given by Microsoft is that the data source name cannot be arbitrary. It has to match the existing one associated with the current report. Can you check that your report configuration on the Report Server refers to the EXACT same data source as you’re trying to connect to in your code?
If not, you have found a probable cause to your problem.