Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
string directoryReportFile = "D:\upload\Reports\DailyReport.rdl";
string reportFileName = Path.GetFileName(datasetFile);
string reportFullUrl = string.Concat("http://sharepoint/dashboard/Reports/", reportFileName)
SPList reportLibrary = <Reports>;
//First upload all report files
using(FileStream fileStream = File.OpenRead(directoryDatasetFile))
{
reportLibrary.Files.Add(datasetFileName, fileStream, true);
}
//Use this step, if all report files are uploaded. Some reports use subreports
ItemReferenceData[] itemDataList = reportingService.GetItemReferences(reportFullUrl, "DataSet");
ItemReference[] items = new ItemReference[itemDataList.Length];
if (itemDataList.Length > 0)
{
//get all dataset files from one report
for (int i = 0; i < itemDataList.Length; i++)
{
ItemReferenceData itemData = itemDataList[i];
ItemReference item = new ItemReference();
item.Name = itemData.Name; //Name of dataset
reportFile.DatasetFullUrl = <GetDatasetFullUrl(itemData.Name, datasetFiles)>;
item.Reference = reportFile.DatasetFullUrl;
items[i] = item;
}
reportingService.SetItemReferences(reportFile.FullUrl, items);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.